17
17
#include "utf8.h"
18
18
#include "worktree.h"
19
19
#include "lockfile.h"
20
+ #include "sequencer.h"
20
21
21
22
static const char cut_line [] =
22
23
"------------------------ >8 ------------------------\n" ;
@@ -1369,12 +1370,22 @@ static void show_rebase_in_progress(struct wt_status *s,
1369
1370
static void show_cherry_pick_in_progress (struct wt_status * s ,
1370
1371
const char * color )
1371
1372
{
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
+
1374
1382
if (s -> hints ) {
1375
1383
if (has_unmerged (s ))
1376
1384
status_printf_ln (s , color ,
1377
1385
_ (" (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)" ));
1378
1389
else
1379
1390
status_printf_ln (s , color ,
1380
1391
_ (" (all conflicts fixed: run \"git cherry-pick --continue\")" ));
@@ -1387,12 +1398,21 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
1387
1398
static void show_revert_in_progress (struct wt_status * s ,
1388
1399
const char * color )
1389
1400
{
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 ));
1392
1409
if (s -> hints ) {
1393
1410
if (has_unmerged (s ))
1394
1411
status_printf_ln (s , color ,
1395
1412
_ (" (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)" ));
1396
1416
else
1397
1417
status_printf_ln (s , color ,
1398
1418
_ (" (all conflicts fixed: run \"git revert --continue\")" ));
@@ -1563,6 +1583,7 @@ void wt_status_get_state(struct repository *r,
1563
1583
{
1564
1584
struct stat st ;
1565
1585
struct object_id oid ;
1586
+ enum replay_action action ;
1566
1587
1567
1588
if (!stat (git_path_merge_head (r ), & st )) {
1568
1589
wt_status_check_rebase (NULL , state );
@@ -1580,7 +1601,15 @@ void wt_status_get_state(struct repository *r,
1580
1601
state -> revert_in_progress = 1 ;
1581
1602
oidcpy (& state -> revert_head_oid , & oid );
1582
1603
}
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
+ }
1584
1613
if (get_detached_from )
1585
1614
wt_status_get_detached_from (r , state );
1586
1615
}
0 commit comments