@@ -36,18 +36,19 @@ interface IGitState {
3636export class GitExtension implements IGitExtension {
3737 constructor (
3838 app : JupyterFrontEnd = null ,
39- settings ? : ISettingRegistry . ISettings ,
40- state ? : IStateDB
39+ settings : ISettingRegistry . ISettings = null ,
40+ state : IStateDB = null
4141 ) {
4242 const model = this ;
4343 this . _app = app ;
44+ this . _stateDB = state ;
4445
45- // Load state extension
4646 this . _state = {
4747 isRepositoryPin : false ,
4848 pathRepository : null
4949 } ;
5050
51+ // Load state extension
5152 this . _restored = app . restored . then ( ( ) => {
5253 if ( state ) {
5354 return state
@@ -111,19 +112,17 @@ export class GitExtension implements IGitExtension {
111112 * @param settings - settings registry
112113 */
113114 function onSettingsChange ( settings : ISettingRegistry . ISettings ) {
114- const freq = poll . frequency ;
115115 poll . frequency = {
116- interval : settings . composite . refreshInterval as number ,
117- backoff : freq . backoff ,
118- max : freq . max
116+ ...poll . frequency ,
117+ interval : settings . composite . refreshInterval as number
119118 } ;
120119 }
121120 }
122121
123122 /**
124123 * The list of branch in the current repo
125124 */
126- get branches ( ) {
125+ get branches ( ) : Git . IBranch [ ] {
127126 return this . _branches ;
128127 }
129128
@@ -134,7 +133,7 @@ export class GitExtension implements IGitExtension {
134133 /**
135134 * The current branch
136135 */
137- get currentBranch ( ) {
136+ get currentBranch ( ) : Git . IBranch | null {
138137 return this . _currentBranch ;
139138 }
140139
@@ -391,7 +390,9 @@ export class GitExtension implements IGitExtension {
391390 * @param mark Mark to set
392391 */
393392 addMark ( fname : string , mark : boolean ) {
394- this . _currentMarker . add ( fname , mark ) ;
393+ if ( this . _currentMarker ) {
394+ this . _currentMarker . add ( fname , mark ) ;
395+ }
395396 }
396397
397398 /**
@@ -401,7 +402,11 @@ export class GitExtension implements IGitExtension {
401402 * @returns Mark of the file
402403 */
403404 getMark ( fname : string ) : boolean {
404- return this . _currentMarker . get ( fname ) ;
405+ if ( this . _currentMarker ) {
406+ return this . _currentMarker . get ( fname ) ;
407+ } else {
408+ return false ;
409+ }
405410 }
406411
407412 /**
@@ -410,7 +415,9 @@ export class GitExtension implements IGitExtension {
410415 * @param fname Filename
411416 */
412417 toggleMark ( fname : string ) {
413- this . _currentMarker . toggle ( fname ) ;
418+ if ( this . _currentMarker ) {
419+ this . _currentMarker . toggle ( fname ) ;
420+ }
414421 }
415422
416423 /**
@@ -1079,27 +1086,27 @@ export class GitExtension implements IGitExtension {
10791086 return this . _currentMarker ;
10801087 }
10811088
1082- private _status : Git . IStatusFileResult [ ] = [ ] ;
1083- private _branches : Git . IBranch [ ] ;
1084- private _currentBranch : Git . IBranch ;
1085- private _serverRoot : string ;
10861089 private _app : JupyterFrontEnd | null ;
1090+ private _branches : Git . IBranch [ ] = [ ] ;
1091+ private _currentBranch : Git . IBranch | null = null ;
1092+ private _currentMarker : BranchMarker = null ;
10871093 private _diffProviders : { [ key : string ] : Git . IDiffCallback } = { } ;
1094+ private _headChanged = new Signal < IGitExtension , void > ( this ) ;
10881095 private _isDisposed = false ;
10891096 private _markerCache : Markers = new Markers ( ( ) => this . _markChanged . emit ( ) ) ;
1090- private _currentMarker : BranchMarker = null ;
1091- private _readyPromise : Promise < void > = Promise . resolve ( ) ;
1097+ private _markChanged = new Signal < IGitExtension , void > ( this ) ;
10921098 private _pendingReadyPromise = 0 ;
10931099 private _poll : Poll ;
1094- private _headChanged = new Signal < IGitExtension , void > ( this ) ;
1095- private _markChanged = new Signal < IGitExtension , void > ( this ) ;
1100+ private _readyPromise : Promise < void > = Promise . resolve ( ) ;
10961101 private _repositoryChanged = new Signal <
10971102 IGitExtension ,
10981103 IChangedArgs < string | null >
10991104 > ( this ) ;
11001105 private _restored : Promise < void > ;
1106+ private _serverRoot : string ;
11011107 private _state : IGitState ;
11021108 private _stateDB : IStateDB | null = null ;
1109+ private _status : Git . IStatusFileResult [ ] = [ ] ;
11031110 private _statusChanged = new Signal < IGitExtension , Git . IStatusFileResult [ ] > (
11041111 this
11051112 ) ;
0 commit comments