mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
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
This commit is contained in:
commit
391414e971
@ -774,6 +774,28 @@ EOF
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'status when cherry-picking multiple commits' '
|
||||
git reset --hard cherry_branch &&
|
||||
test_when_finished "git cherry-pick --abort" &&
|
||||
test_must_fail git cherry-pick cherry_branch_second one_cherry &&
|
||||
TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
|
||||
cat >expected <<EOF &&
|
||||
On branch cherry_branch
|
||||
You are currently cherry-picking commit $TO_CHERRY_PICK.
|
||||
(fix conflicts and run "git cherry-pick --continue")
|
||||
(use "git cherry-pick --skip" to skip this patch)
|
||||
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
|
||||
|
||||
Unmerged paths:
|
||||
(use "git add <file>..." to mark resolution)
|
||||
both modified: main.txt
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
EOF
|
||||
git status --untracked-files=no >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'status when cherry-picking after committing conflict resolution' '
|
||||
git reset --hard cherry_branch &&
|
||||
test_when_finished "git cherry-pick --abort" &&
|
||||
|
@ -1793,10 +1793,10 @@ void wt_status_get_state(struct repository *r,
|
||||
oidcpy(&state->revert_head_oid, &oid);
|
||||
}
|
||||
if (!sequencer_get_last_command(r, &action)) {
|
||||
if (action == REPLAY_PICK) {
|
||||
if (action == REPLAY_PICK && !state->cherry_pick_in_progress) {
|
||||
state->cherry_pick_in_progress = 1;
|
||||
oidcpy(&state->cherry_pick_head_oid, null_oid());
|
||||
} else {
|
||||
} else if (action == REPLAY_REVERT && !state->revert_in_progress) {
|
||||
state->revert_in_progress = 1;
|
||||
oidcpy(&state->revert_head_oid, null_oid());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user