mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
Merge branch 'en/merge-unstash-only-on-clean-merge' into maint
The auto-stashed local changes created by "git merge --autostash" was mixed into a conflicted state left in the working tree, which has been corrected. * en/merge-unstash-only-on-clean-merge: merge: only apply autostash when appropriate
This commit is contained in:
commit
2c75b3255b
|
@ -493,7 +493,8 @@ static void finish(struct commit *head_commit,
|
||||||
/* Run a post-merge hook */
|
/* Run a post-merge hook */
|
||||||
run_hooks_l("post-merge", squash ? "1" : "0", NULL);
|
run_hooks_l("post-merge", squash ? "1" : "0", NULL);
|
||||||
|
|
||||||
apply_autostash(git_path_merge_autostash(the_repository));
|
if (new_head)
|
||||||
|
apply_autostash(git_path_merge_autostash(the_repository));
|
||||||
strbuf_release(&reflog_message);
|
strbuf_release(&reflog_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,6 +1757,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
"stopped before committing as requested\n"));
|
"stopped before committing as requested\n"));
|
||||||
else
|
else
|
||||||
ret = suggest_conflicts();
|
ret = suggest_conflicts();
|
||||||
|
if (autostash)
|
||||||
|
printf(_("When finished, apply stashed changes with `git stash pop`\n"));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (!automerge_was_ok) {
|
if (!automerge_was_ok) {
|
||||||
|
|
|
@ -255,6 +255,15 @@ test_expect_success 'merge --squash c3 with c7' '
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'merge --squash --autostash conflict does not attempt to apply autostash' '
|
||||||
|
git reset --hard c3 &&
|
||||||
|
>unrelated &&
|
||||||
|
git add unrelated &&
|
||||||
|
test_must_fail git merge --squash c7 --autostash >out 2>err &&
|
||||||
|
! grep "Applying autostash resulted in conflicts." err &&
|
||||||
|
grep "When finished, apply stashed changes with \`git stash pop\`" out
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
|
test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
|
||||||
git config commit.cleanup scissors &&
|
git config commit.cleanup scissors &&
|
||||||
git reset --hard c3 &&
|
git reset --hard c3 &&
|
||||||
|
|
Loading…
Reference in a new issue