Skip to content

Commit 391414e

Browse files
committed
Merge branch 'jk/cherry-pick-revert-status'
During a cherry-pick or revert session that works on multiple commits, "git status" did not give correct information, which has been corrected. * jk/cherry-pick-revert-status: fix cherry-pick/revert status when doing multiple commits
2 parents 84b889b + a096a88 commit 391414e

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

t/t7512-status-help.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,28 @@ EOF
774774
test_cmp expected actual
775775
'
776776

777+
test_expect_success 'status when cherry-picking multiple commits' '
778+
git reset --hard cherry_branch &&
779+
test_when_finished "git cherry-pick --abort" &&
780+
test_must_fail git cherry-pick cherry_branch_second one_cherry &&
781+
TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
782+
cat >expected <<EOF &&
783+
On branch cherry_branch
784+
You are currently cherry-picking commit $TO_CHERRY_PICK.
785+
(fix conflicts and run "git cherry-pick --continue")
786+
(use "git cherry-pick --skip" to skip this patch)
787+
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
788+
789+
Unmerged paths:
790+
(use "git add <file>..." to mark resolution)
791+
both modified: main.txt
792+
793+
no changes added to commit (use "git add" and/or "git commit -a")
794+
EOF
795+
git status --untracked-files=no >actual &&
796+
test_cmp expected actual
797+
'
798+
777799
test_expect_success 'status when cherry-picking after committing conflict resolution' '
778800
git reset --hard cherry_branch &&
779801
test_when_finished "git cherry-pick --abort" &&

wt-status.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,10 +1793,10 @@ void wt_status_get_state(struct repository *r,
17931793
oidcpy(&state->revert_head_oid, &oid);
17941794
}
17951795
if (!sequencer_get_last_command(r, &action)) {
1796-
if (action == REPLAY_PICK) {
1796+
if (action == REPLAY_PICK && !state->cherry_pick_in_progress) {
17971797
state->cherry_pick_in_progress = 1;
17981798
oidcpy(&state->cherry_pick_head_oid, null_oid());
1799-
} else {
1799+
} else if (action == REPLAY_REVERT && !state->revert_in_progress) {
18001800
state->revert_in_progress = 1;
18011801
oidcpy(&state->revert_head_oid, null_oid());
18021802
}

0 commit comments

Comments
 (0)