@@ -107,19 +107,24 @@ public RebaseInProgress(Repository repo) : base(repo.FullPath, "rebase")
107107 {
108108 _gitDir = repo . GitDir ;
109109
110+ HeadName = File . ReadAllText ( Path . Combine ( repo . GitDir , "rebase-merge" , "head-name" ) ) . Trim ( ) ;
111+ if ( HeadName . StartsWith ( "refs/heads/" ) )
112+ HeadName = HeadName . Substring ( 11 ) ;
113+ else if ( HeadName . StartsWith ( "refs/tags/" ) )
114+ HeadName = HeadName . Substring ( 10 ) ;
115+
110116 var stoppedSHAPath = Path . Combine ( repo . GitDir , "rebase-merge" , "stopped-sha" ) ;
117+ var stoppedSHA = string . Empty ;
111118 if ( File . Exists ( stoppedSHAPath ) )
112- {
113- var stoppedSHA = File . ReadAllText ( stoppedSHAPath ) . Trim ( ) ;
119+ stoppedSHA = File . ReadAllText ( stoppedSHAPath ) . Trim ( ) ;
120+ else
121+ stoppedSHA = new Commands . QueryRevisionByRefName ( repo . FullPath , HeadName ) . Result ( ) ;
122+
123+ if ( ! string . IsNullOrEmpty ( stoppedSHA ) )
114124 StoppedAt = new Commands . QuerySingleCommit ( repo . FullPath , stoppedSHA ) . Result ( ) ?? new Models . Commit ( ) { SHA = stoppedSHA } ;
115- }
116125
117126 var ontoSHA = File . ReadAllText ( Path . Combine ( repo . GitDir , "rebase-merge" , "onto" ) ) . Trim ( ) ;
118127 Onto = new Commands . QuerySingleCommit ( repo . FullPath , ontoSHA ) . Result ( ) ?? new Models . Commit ( ) { SHA = ontoSHA } ;
119-
120- HeadName = File . ReadAllText ( Path . Combine ( repo . GitDir , "rebase-merge" , "head-name" ) ) . Trim ( ) ;
121- if ( HeadName . StartsWith ( "refs/heads/" ) )
122- HeadName = HeadName . Substring ( 11 ) ;
123128 }
124129
125130 public override bool Continue ( )
0 commit comments