@@ -79,17 +79,20 @@ public struct ConfigBranch
7979
8080 public string name ;
8181 public ConfigRemote remote ;
82+ public string trackingBranch ;
8283
8384 public ConfigBranch ( string name )
8485 {
8586 this . name = name ;
87+ this . trackingBranch = null ;
8688 remote = ConfigRemote . Default ;
8789 }
8890
89- public ConfigBranch ( string name , ConfigRemote ? remote )
91+ public ConfigBranch ( string name , ConfigRemote ? remote , string trackingBranch )
9092 {
9193 this . name = name ;
9294 this . remote = remote ?? ConfigRemote . Default ;
95+ this . trackingBranch = trackingBranch != null && trackingBranch . StartsWith ( "refs/heads" ) ? trackingBranch . Substring ( "refs/heads" . Length + 1 ) : null ;
9396 }
9497
9598 public override int GetHashCode ( )
@@ -137,6 +140,7 @@ public bool Equals(ConfigBranch other)
137140 public bool IsTracking => Remote . HasValue ;
138141
139142 public string Name => name ;
143+ public string TrackingBranch => trackingBranch ;
140144
141145 public ConfigRemote ? Remote => Equals ( remote , ConfigRemote . Default ) ? ( ConfigRemote ? ) null : remote ;
142146
@@ -189,7 +193,7 @@ public IEnumerable<ConfigBranch> GetBranches()
189193 return groups
190194 . Where ( x => x . Key == "branch" )
191195 . SelectMany ( x => x . Value )
192- . Select ( x => new ConfigBranch ( x . Key , GetRemote ( x . Value . TryGetString ( "remote" ) ) ) ) ;
196+ . Select ( x => new ConfigBranch ( x . Key , GetRemote ( x . Value . TryGetString ( "remote" ) ) , x . Value . TryGetString ( "merge" ) ) ) ;
193197 }
194198
195199 public IEnumerable < ConfigRemote > GetRemotes ( )
@@ -217,7 +221,7 @@ public IEnumerable<ConfigRemote> GetRemotes()
217221 . Where ( x => x . Key == "branch" )
218222 . SelectMany ( x => x . Value )
219223 . Where ( x => x . Key == branch )
220- . Select ( x => new ConfigBranch ( x . Key , GetRemote ( x . Value . TryGetString ( "remote" ) ) ) as ConfigBranch ? )
224+ . Select ( x => new ConfigBranch ( x . Key , GetRemote ( x . Value . TryGetString ( "remote" ) ) , x . Value . TryGetString ( "merge" ) ) as ConfigBranch ? )
221225 . FirstOrDefault ( ) ;
222226 }
223227
0 commit comments