1717#include "utf8.h"
1818#include "worktree.h"
1919#include "lockfile.h"
20+ #include "sequencer.h"
2021
2122static const char cut_line [] =
2223"------------------------ >8 ------------------------\n" ;
@@ -1386,12 +1387,22 @@ static void show_rebase_in_progress(struct wt_status *s,
13861387static void show_cherry_pick_in_progress (struct wt_status * s ,
13871388 const char * color )
13881389{
1389- status_printf_ln (s , color , _ ("You are currently cherry-picking commit %s." ),
1390- find_unique_abbrev (& s -> state .cherry_pick_head_oid , DEFAULT_ABBREV ));
1390+ if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1391+ status_printf_ln (s , color ,
1392+ _ ("Cherry-pick currently in progress." ));
1393+ else
1394+ status_printf_ln (s , color ,
1395+ _ ("You are currently cherry-picking commit %s." ),
1396+ find_unique_abbrev (& s -> state .cherry_pick_head_oid ,
1397+ DEFAULT_ABBREV ));
1398+
13911399 if (s -> hints ) {
13921400 if (has_unmerged (s ))
13931401 status_printf_ln (s , color ,
13941402 _ (" (fix conflicts and run \"git cherry-pick --continue\")" ));
1403+ else if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1404+ status_printf_ln (s , color ,
1405+ _ (" (run \"git cherry-pick --continue\" to continue)" ));
13951406 else
13961407 status_printf_ln (s , color ,
13971408 _ (" (all conflicts fixed: run \"git cherry-pick --continue\")" ));
@@ -1404,12 +1415,21 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
14041415static void show_revert_in_progress (struct wt_status * s ,
14051416 const char * color )
14061417{
1407- status_printf_ln (s , color , _ ("You are currently reverting commit %s." ),
1408- find_unique_abbrev (& s -> state .revert_head_oid , DEFAULT_ABBREV ));
1418+ if (is_null_oid (& s -> state .revert_head_oid ))
1419+ status_printf_ln (s , color ,
1420+ _ ("Revert currently in progress." ));
1421+ else
1422+ status_printf_ln (s , color ,
1423+ _ ("You are currently reverting commit %s." ),
1424+ find_unique_abbrev (& s -> state .revert_head_oid ,
1425+ DEFAULT_ABBREV ));
14091426 if (s -> hints ) {
14101427 if (has_unmerged (s ))
14111428 status_printf_ln (s , color ,
14121429 _ (" (fix conflicts and run \"git revert --continue\")" ));
1430+ else if (is_null_oid (& s -> state .revert_head_oid ))
1431+ status_printf_ln (s , color ,
1432+ _ (" (run \"git revert --continue\" to continue)" ));
14131433 else
14141434 status_printf_ln (s , color ,
14151435 _ (" (all conflicts fixed: run \"git revert --continue\")" ));
@@ -1580,6 +1600,7 @@ void wt_status_get_state(struct repository *r,
15801600{
15811601 struct stat st ;
15821602 struct object_id oid ;
1603+ enum replay_action action ;
15831604
15841605 if (!stat (git_path_merge_head (r ), & st )) {
15851606 wt_status_check_rebase (NULL , state );
@@ -1597,7 +1618,15 @@ void wt_status_get_state(struct repository *r,
15971618 state -> revert_in_progress = 1 ;
15981619 oidcpy (& state -> revert_head_oid , & oid );
15991620 }
1600-
1621+ if (!sequencer_get_last_command (r , & action )) {
1622+ if (action == REPLAY_PICK ) {
1623+ state -> cherry_pick_in_progress = 1 ;
1624+ oidcpy (& state -> cherry_pick_head_oid , & null_oid );
1625+ } else {
1626+ state -> revert_in_progress = 1 ;
1627+ oidcpy (& state -> revert_head_oid , & null_oid );
1628+ }
1629+ }
16011630 if (get_detached_from )
16021631 wt_status_get_detached_from (r , state );
16031632}
0 commit comments