@@ -1342,9 +1342,11 @@ static int split_commit_in_progress(struct wt_status *s)
13421342
13431343/*
13441344 * Turn
1345- * "pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message"
1345+ * "pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message" and
1346+ * "merge -C d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some-branch"
13461347 * into
1347- * "pick d6a2f03 some message"
1348+ * "pick d6a2f03 some message" and
1349+ * "merge -C d6a2f03 some-branch"
13481350 *
13491351 * The function assumes that the line does not contain useless spaces
13501352 * before or after the command.
@@ -1360,20 +1362,31 @@ static void abbrev_oid_in_line(struct strbuf *line)
13601362 starts_with (line -> buf , "l " ))
13611363 return ;
13621364
1363- split = strbuf_split_max (line , ' ' , 3 );
1365+ split = strbuf_split_max (line , ' ' , 4 );
13641366 if (split [0 ] && split [1 ]) {
13651367 struct object_id oid ;
1366-
1368+ struct strbuf * hash ;
1369+
1370+ if ((!strcmp (split [0 ]-> buf , "merge " ) ||
1371+ !strcmp (split [0 ]-> buf , "m " ) ||
1372+ !strcmp (split [0 ]-> buf , "fixup " ) ||
1373+ !strcmp (split [0 ]-> buf , "f " )) &&
1374+ (!strcmp (split [1 ]-> buf , "-C " ) ||
1375+ !strcmp (split [1 ]-> buf , "-c " ))) {
1376+ hash = split [2 ];
1377+ } else {
1378+ hash = split [1 ];
1379+ }
13671380 /*
13681381 * strbuf_split_max left a space. Trim it and re-add
13691382 * it after abbreviation.
13701383 */
1371- strbuf_trim (split [ 1 ] );
1372- if (!repo_get_oid (the_repository , split [ 1 ] -> buf , & oid )) {
1373- strbuf_reset (split [ 1 ] );
1374- strbuf_add_unique_abbrev (split [ 1 ] , & oid ,
1384+ strbuf_trim (hash );
1385+ if (!repo_get_oid (the_repository , hash -> buf , & oid )) {
1386+ strbuf_reset (hash );
1387+ strbuf_add_unique_abbrev (hash , & oid ,
13751388 DEFAULT_ABBREV );
1376- strbuf_addch (split [ 1 ] , ' ' );
1389+ strbuf_addch (hash , ' ' );
13771390 strbuf_reset (line );
13781391 for (i = 0 ; split [i ]; i ++ )
13791392 strbuf_addbuf (line , split [i ]);
@@ -1731,6 +1744,7 @@ int wt_status_check_rebase(const struct worktree *wt,
17311744 struct wt_status_state * state )
17321745{
17331746 struct stat st ;
1747+ struct string_list have_done = STRING_LIST_INIT_DUP ;
17341748
17351749 if (!stat (worktree_git_path (the_repository , wt , "rebase-apply" ), & st )) {
17361750 if (!stat (worktree_git_path (the_repository , wt , "rebase-apply/applying" ), & st )) {
@@ -1747,8 +1761,12 @@ int wt_status_check_rebase(const struct worktree *wt,
17471761 state -> rebase_interactive_in_progress = 1 ;
17481762 else
17491763 state -> rebase_in_progress = 1 ;
1764+ read_rebase_todolist ("rebase-merge/done" , & have_done );
1765+ if (have_done .nr > 0 && starts_with (have_done .items [have_done .nr - 1 ].string , "merge" ))
1766+ state -> merge_during_rebase_in_progress = 1 ;
17501767 state -> branch = get_branch (wt , "rebase-merge/head-name" );
17511768 state -> onto = get_branch (wt , "rebase-merge/onto" );
1769+ string_list_clear (& have_done , 0 );
17521770 } else
17531771 return 0 ;
17541772 return 1 ;
@@ -1842,10 +1860,15 @@ static void wt_longstatus_print_state(struct wt_status *s)
18421860
18431861 if (state -> merge_in_progress ) {
18441862 if (state -> rebase_interactive_in_progress ) {
1845- show_rebase_information (s , state_color );
1846- fputs ("\n" , s -> fp );
1847- }
1848- show_merge_in_progress (s , state_color );
1863+ if (state -> merge_during_rebase_in_progress )
1864+ show_rebase_in_progress (s , state_color );
1865+ else {
1866+ show_rebase_information (s , state_color );
1867+ fputs ("\n" , s -> fp );
1868+ show_merge_in_progress (s , state_color );
1869+ }
1870+ } else
1871+ show_merge_in_progress (s , state_color );
18491872 } else if (state -> am_in_progress )
18501873 show_am_in_progress (s , state_color );
18511874 else if (state -> rebase_in_progress || state -> rebase_interactive_in_progress )
0 commit comments