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" ;
@@ -1398,12 +1399,22 @@ static void show_rebase_in_progress(struct wt_status *s,
13981399static void show_cherry_pick_in_progress (struct wt_status * s ,
13991400 const char * color )
14001401{
1401- status_printf_ln (s , color , _ ("You are currently cherry-picking commit %s." ),
1402- find_unique_abbrev (& s -> state .cherry_pick_head_oid , DEFAULT_ABBREV ));
1402+ if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1403+ status_printf_ln (s , color ,
1404+ _ ("Cherry-pick currently in progress." ));
1405+ else
1406+ status_printf_ln (s , color ,
1407+ _ ("You are currently cherry-picking commit %s." ),
1408+ find_unique_abbrev (& s -> state .cherry_pick_head_oid ,
1409+ DEFAULT_ABBREV ));
1410+
14031411 if (s -> hints ) {
14041412 if (has_unmerged (s ))
14051413 status_printf_ln (s , color ,
14061414 _ (" (fix conflicts and run \"git cherry-pick --continue\")" ));
1415+ else if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1416+ status_printf_ln (s , color ,
1417+ _ (" (run \"git cherry-pick --continue\" to continue)" ));
14071418 else
14081419 status_printf_ln (s , color ,
14091420 _ (" (all conflicts fixed: run \"git cherry-pick --continue\")" ));
@@ -1416,12 +1427,21 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
14161427static void show_revert_in_progress (struct wt_status * s ,
14171428 const char * color )
14181429{
1419- status_printf_ln (s , color , _ ("You are currently reverting commit %s." ),
1420- find_unique_abbrev (& s -> state .revert_head_oid , DEFAULT_ABBREV ));
1430+ if (is_null_oid (& s -> state .revert_head_oid ))
1431+ status_printf_ln (s , color ,
1432+ _ ("Revert currently in progress." ));
1433+ else
1434+ status_printf_ln (s , color ,
1435+ _ ("You are currently reverting commit %s." ),
1436+ find_unique_abbrev (& s -> state .revert_head_oid ,
1437+ DEFAULT_ABBREV ));
14211438 if (s -> hints ) {
14221439 if (has_unmerged (s ))
14231440 status_printf_ln (s , color ,
14241441 _ (" (fix conflicts and run \"git revert --continue\")" ));
1442+ else if (is_null_oid (& s -> state .revert_head_oid ))
1443+ status_printf_ln (s , color ,
1444+ _ (" (run \"git revert --continue\" to continue)" ));
14251445 else
14261446 status_printf_ln (s , color ,
14271447 _ (" (all conflicts fixed: run \"git revert --continue\")" ));
@@ -1592,6 +1612,7 @@ void wt_status_get_state(struct repository *r,
15921612{
15931613 struct stat st ;
15941614 struct object_id oid ;
1615+ enum replay_action action ;
15951616
15961617 if (!stat (git_path_merge_head (r ), & st )) {
15971618 wt_status_check_rebase (NULL , state );
@@ -1609,7 +1630,15 @@ void wt_status_get_state(struct repository *r,
16091630 state -> revert_in_progress = 1 ;
16101631 oidcpy (& state -> revert_head_oid , & oid );
16111632 }
1612-
1633+ if (!sequencer_get_last_command (r , & action )) {
1634+ if (action == REPLAY_PICK ) {
1635+ state -> cherry_pick_in_progress = 1 ;
1636+ oidcpy (& state -> cherry_pick_head_oid , & null_oid );
1637+ } else {
1638+ state -> revert_in_progress = 1 ;
1639+ oidcpy (& state -> revert_head_oid , & null_oid );
1640+ }
1641+ }
16131642 if (get_detached_from )
16141643 wt_status_get_detached_from (r , state );
16151644}
0 commit comments