Message ID | pull.1139.git.git.1636902454370.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | subtree: ignore merge.ff setting | expand |
On Sun, Nov 14 2021, Thomas Koutcher via GitGitGadget wrote: > From: Thomas Koutcher <thomas.koutcher@online.fr> > > When `merge.ff` is set to `only` in .gitconfig, `git subtree pull` will > fail with error `fatal: Not possible to fast-forward, aborting.`. This > fix ignores the `merge.ff` setting when using `git merge` within subtree. > > Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr> > --- > subtree: ignore merge.ff setting > > When merge.ff is set to only in .gitconfig, git subtree pull will fail > with error fatal: Not possible to fast-forward, aborting.. This fix > ignores the merge.ff setting when using git merge within subtree. > > Signed-off-by: Thomas Koutcher thomas.koutcher@online.fr > > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1139%2Fkoutcher%2Fsubtree-merge-ff-fix-v1 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1139/koutcher/subtree-merge-ff-fix-v1 > Pull-Request: https://github.com/git/git/pull/1139 > > contrib/subtree/git-subtree.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh > index 7f767b5c38f..de918d9fb05 100755 > --- a/contrib/subtree/git-subtree.sh > +++ b/contrib/subtree/git-subtree.sh > @@ -976,10 +976,10 @@ cmd_merge () { > > if test -n "$arg_addmerge_message" > then > - git merge -Xsubtree="$arg_prefix" \ > + git -c merge.ff= merge -Xsubtree="$arg_prefix" \ > --message="$arg_addmerge_message" "$rev" > else > - git merge -Xsubtree="$arg_prefix" $rev > + git -c merge.ff= merge -Xsubtree="$arg_prefix" $rev > fi > } "-c merge.ff=" works, it's lesser known syntax. I'd tihnk "-c merge.ff=false" would be better here, i.e. what matches "git config"'s description of "merge.ff".
"Thomas Koutcher via GitGitGadget" <gitgitgadget@gmail.com> writes: > From: Thomas Koutcher <thomas.koutcher@online.fr> > > When `merge.ff` is set to `only` in .gitconfig, `git subtree pull` will > fail with error `fatal: Not possible to fast-forward, aborting.`. This > fix ignores the `merge.ff` setting when using `git merge` within subtree. The first sentence is understandasble as a statement of fact. There is a small logic gap between it and the second sentence, calling the change in the patch a "fix". I think ", but the command does want to make merges in these places." added after the first sentence would fix it. > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1139%2Fkoutcher%2Fsubtree-merge-ff-fix-v1 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1139/koutcher/subtree-merge-ff-fix-v1 > Pull-Request: https://github.com/git/git/pull/1139 > > contrib/subtree/git-subtree.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh > index 7f767b5c38f..de918d9fb05 100755 > --- a/contrib/subtree/git-subtree.sh > +++ b/contrib/subtree/git-subtree.sh > @@ -976,10 +976,10 @@ cmd_merge () { > > if test -n "$arg_addmerge_message" > then > - git merge -Xsubtree="$arg_prefix" \ > + git -c merge.ff= merge -Xsubtree="$arg_prefix" \ > --message="$arg_addmerge_message" "$rev" > else > - git merge -Xsubtree="$arg_prefix" $rev > + git -c merge.ff= merge -Xsubtree="$arg_prefix" $rev And the natural way to override what is configured is to pass a countermanding command line option, e.g. "git merge --ff" (or "git merge --no-ff", if it wants to always create a merge even when taking a change that is a descendant---I do not know the need of "git subtree" well enough to tell), and that is easier to read than "git -c ...".
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 7f767b5c38f..de918d9fb05 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -976,10 +976,10 @@ cmd_merge () { if test -n "$arg_addmerge_message" then - git merge -Xsubtree="$arg_prefix" \ + git -c merge.ff= merge -Xsubtree="$arg_prefix" \ --message="$arg_addmerge_message" "$rev" else - git merge -Xsubtree="$arg_prefix" $rev + git -c merge.ff= merge -Xsubtree="$arg_prefix" $rev fi }