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" ;
@@ -1369,12 +1370,22 @@ static void show_rebase_in_progress(struct wt_status *s,
13691370static void show_cherry_pick_in_progress (struct wt_status * s ,
13701371 const char * color )
13711372{
1372- status_printf_ln (s , color , _ ("You are currently cherry-picking commit %s." ),
1373- find_unique_abbrev (& s -> state .cherry_pick_head_oid , DEFAULT_ABBREV ));
1373+ if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1374+ status_printf_ln (s , color ,
1375+ _ ("Cherry-pick currently in progress." ));
1376+ else
1377+ status_printf_ln (s , color ,
1378+ _ ("You are currently cherry-picking commit %s." ),
1379+ find_unique_abbrev (& s -> state .cherry_pick_head_oid ,
1380+ DEFAULT_ABBREV ));
1381+
13741382 if (s -> hints ) {
13751383 if (has_unmerged (s ))
13761384 status_printf_ln (s , color ,
13771385 _ (" (fix conflicts and run \"git cherry-pick --continue\")" ));
1386+ else if (is_null_oid (& s -> state .cherry_pick_head_oid ))
1387+ status_printf_ln (s , color ,
1388+ _ (" (run \"git cherry-pick --continue\" to continue)" ));
13781389 else
13791390 status_printf_ln (s , color ,
13801391 _ (" (all conflicts fixed: run \"git cherry-pick --continue\")" ));
@@ -1387,12 +1398,21 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
13871398static void show_revert_in_progress (struct wt_status * s ,
13881399 const char * color )
13891400{
1390- status_printf_ln (s , color , _ ("You are currently reverting commit %s." ),
1391- find_unique_abbrev (& s -> state .revert_head_oid , DEFAULT_ABBREV ));
1401+ if (is_null_oid (& s -> state .revert_head_oid ))
1402+ status_printf_ln (s , color ,
1403+ _ ("Revert currently in progress." ));
1404+ else
1405+ status_printf_ln (s , color ,
1406+ _ ("You are currently reverting commit %s." ),
1407+ find_unique_abbrev (& s -> state .revert_head_oid ,
1408+ DEFAULT_ABBREV ));
13921409 if (s -> hints ) {
13931410 if (has_unmerged (s ))
13941411 status_printf_ln (s , color ,
13951412 _ (" (fix conflicts and run \"git revert --continue\")" ));
1413+ else if (is_null_oid (& s -> state .revert_head_oid ))
1414+ status_printf_ln (s , color ,
1415+ _ (" (run \"git revert --continue\" to continue)" ));
13961416 else
13971417 status_printf_ln (s , color ,
13981418 _ (" (all conflicts fixed: run \"git revert --continue\")" ));
@@ -1563,6 +1583,7 @@ void wt_status_get_state(struct repository *r,
15631583{
15641584 struct stat st ;
15651585 struct object_id oid ;
1586+ enum replay_action action ;
15661587
15671588 if (!stat (git_path_merge_head (r ), & st )) {
15681589 wt_status_check_rebase (NULL , state );
@@ -1580,7 +1601,15 @@ void wt_status_get_state(struct repository *r,
15801601 state -> revert_in_progress = 1 ;
15811602 oidcpy (& state -> revert_head_oid , & oid );
15821603 }
1583-
1604+ if (!sequencer_get_last_command (r , & action )) {
1605+ if (action == REPLAY_PICK ) {
1606+ state -> cherry_pick_in_progress = 1 ;
1607+ oidcpy (& state -> cherry_pick_head_oid , & null_oid );
1608+ } else {
1609+ state -> revert_in_progress = 1 ;
1610+ oidcpy (& state -> revert_head_oid , & null_oid );
1611+ }
1612+ }
15841613 if (get_detached_from )
15851614 wt_status_get_detached_from (r , state );
15861615}
0 commit comments