@@ -346,6 +346,7 @@ private void SetupWatcher()
346
346
private void UpdateHead ( )
347
347
{
348
348
var head = repositoryPaths . DotGitHead . ReadAllLines ( ) . FirstOrDefault ( ) ;
349
+ Logger . Trace ( "UpdateHead: {0}" , head ?? "[NULL]" ) ;
349
350
UpdateCurrentBranchAndRemote ( head ) ;
350
351
}
351
352
@@ -428,6 +429,11 @@ private void UpdateCurrentBranchAndRemote(string head)
428
429
{
429
430
var branchName = head . Substring ( head . IndexOf ( "refs/heads/" ) + "refs/heads/" . Length ) ;
430
431
branch = config . GetBranch ( branchName ) ;
432
+
433
+ if ( ! branch . HasValue )
434
+ {
435
+ branch = new ConfigBranch { Name = branchName } ;
436
+ }
431
437
}
432
438
433
439
var defaultRemote = "origin" ;
@@ -452,7 +458,10 @@ private void UpdateCurrentBranchAndRemote(string head)
452
458
}
453
459
}
454
460
461
+ Logger . Trace ( "OnCurrentBranchUpdated: {0}" , branch . HasValue ? branch . Value . ToString ( ) : "[NULL]" ) ;
455
462
OnCurrentBranchUpdated ? . Invoke ( branch ) ;
463
+
464
+ Logger . Trace ( "OnCurrentRemoteUpdated: {0}" , remote . HasValue ? remote . Value . ToString ( ) : "[NULL]" ) ;
456
465
OnCurrentRemoteUpdated ? . Invoke ( remote ) ;
457
466
}
458
467
@@ -476,13 +485,13 @@ private void Watcher_OnLocalBranchChanged(string name)
476
485
477
486
private void UpdateConfigData ( bool resetConfig = false )
478
487
{
488
+ Logger . Trace ( "UpdateConfigData reset:{0}" , resetConfig ) ;
489
+
479
490
if ( resetConfig )
480
491
{
481
492
config . Reset ( ) ;
482
493
}
483
494
484
- Logger . Trace ( "RefreshConfigData" ) ;
485
-
486
495
LoadBranchesFromConfig ( ) ;
487
496
LoadRemotesFromConfig ( ) ;
488
497
UpdateHead ( ) ;
@@ -494,6 +503,8 @@ private void LoadBranchesFromConfig()
494
503
495
504
var branches = new Dictionary < string , ConfigBranch > ( ) ;
496
505
LoadBranchesFromConfig ( branches , repositoryPaths . BranchesPath , config . GetBranches ( ) . Where ( x => x . IsTracking ) , "" ) ;
506
+
507
+ Logger . Trace ( "OnLocalBranchListUpdated {0} branches" , branches . Count ) ;
497
508
OnLocalBranchListUpdated ? . Invoke ( branches ) ;
498
509
}
499
510
@@ -542,6 +553,7 @@ private void LoadRemotesFromConfig()
542
553
}
543
554
}
544
555
556
+ Logger . Trace ( "OnRemoteBranchListUpdated {0} remotes" , remotes . Count ) ;
545
557
OnRemoteBranchListUpdated ? . Invoke ( remotes , remoteBranches ) ;
546
558
}
547
559
0 commit comments