RE: [PATCH 3/4] merge: apply autostash if fast-forward fails
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jul 23, 2021, 16:02 UTC
- Message-ID
- <60fae7f8747c_defb20888@natae.notmuch>
- In-Reply-To
- <86becf764243f129c980f073127ec3f08fd4477c.1627042470.git.gitgitgadget@gmail.com>
Philippe Blain via GitGitGadget wrote:
> From: Philippe Blain <levraiphilippeblain@gmail.com>
Show 10 quoted lines
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -1560,6 +1560,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
> &head_commit->object.oid,
> &commit->object.oid,
> overwrite_ignore)) {
> + apply_autostash(git_path_merge_autostash(the_repository));
> ret = 1;
> goto done;
> }I can verify that this fixes my simple test.
Show 23 quoted lines
> diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh > index 1cbc9715a81..216113d3537 100755 > --- a/t/t7600-merge.sh > +++ b/t/t7600-merge.sh > @@ -122,6 +122,8 @@ test_expect_success 'setup' ' > c0=$(git rev-parse HEAD) && > cp file.1 file && > git add file && > + cp file.1 other && > + git add other && > test_tick && > git commit -m "commit 1" && > git tag c1 && > @@ -711,6 +713,15 @@ test_expect_success 'fast-forward merge with --autostash' ' > test_cmp result.1-5 file > ' > > +test_expect_success 'failed fast-forward merge with --autostash' ' > + git reset --hard c0 && > + git merge-file file file.orig file.5 && > + cp file.5 other && > + test_must_fail git merge --autostash c1 2>err && > + test_i18ngrep "Applied autostash." err &&
I've heard others test we are moving away from test_i18ngrep in favor of grep.
Show 6 quoted lines
> + test_cmp file.5 file > +' > + > test_expect_success 'octopus merge with --autostash' ' > git reset --hard c1 && > git merge-file file file.orig file.3 &&
-- Felipe Contreras