@@ -198,6 +198,7 @@ class GitRepository
198
198
void establish_description (void );
199
199
void establish_tag (void );
200
200
void establish_state (void );
201
+ void establish_state_rebasing (void );
201
202
void establish_dirty_staged_untracked (void );
202
203
// These are static methods because otherwise, their signatures do not
203
204
// match the required signatures for use as callback functions.
@@ -310,7 +311,7 @@ void GitRepository::establish_state(void)
310
311
case C::GIT_REPOSITORY_STATE_REBASE:
311
312
case C::GIT_REPOSITORY_STATE_REBASE_INTERACTIVE:
312
313
case C::GIT_REPOSITORY_STATE_REBASE_MERGE:
313
- this ->state = " rebasing " ;
314
+ this ->establish_state_rebasing () ;
314
315
break ;
315
316
case C::GIT_REPOSITORY_STATE_REVERT:
316
317
case C::GIT_REPOSITORY_STATE_REVERT_SEQUENCE:
@@ -319,6 +320,30 @@ void GitRepository::establish_state(void)
319
320
}
320
321
}
321
322
323
+ /* *
324
+ * Obtain the rebase state of the working tree of the current Git repository.
325
+ */
326
+ void GitRepository::establish_state_rebasing (void )
327
+ {
328
+ this ->state = " rebasing" ;
329
+ std::ifstream msgnum_file (this ->gitdir / " rebase-merge/msgnum" );
330
+ if (!msgnum_file.good ())
331
+ {
332
+ return ;
333
+ }
334
+ std::ifstream end_file (this ->gitdir / " rebase-merge/end" );
335
+ if (!end_file.good ())
336
+ {
337
+ return ;
338
+ }
339
+ std::string msgnum_contents, end_contents;
340
+ if (!(msgnum_file >> msgnum_contents) || !(end_file >> end_contents))
341
+ {
342
+ return ;
343
+ }
344
+ this ->state += ' ' + msgnum_contents + ' /' + end_contents;
345
+ }
346
+
322
347
/* *
323
348
* Obtain the statuses of the index and working tree of the current Git
324
349
* repository.
0 commit comments