Skip to contentSkip to conversation

subtree: ignore merge.ff setting

PATCH In review Thomas Koutcher via GitGitGadget 5 participants 10 messages Nov 14, 2021 – Feb 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 subtree: ignore merge.ff setting

From: Thomas Koutcher <[email protected]>

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.

---
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.

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(-)
contrib/subtree/git-subtree.sh +2 -2
index 7f767b5c38f..de918d9fb05 100755
@@ -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
 }
 

base-commit: 5fbd2fc5997dfa4d4593a862fe729b1e7a89bcf8

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 29 lines · Thomas Koutcher via GitGitGadget

From: Thomas Koutcher <[email protected]>

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.

---
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.

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(-)
contrib/subtree/git-subtree.sh +0 -0
index 7f767b5c38f..de918d9fb05 100755
@@ -976,10 +976,10 @@ cmd_merge () {
 

contrib/subtree/git-subtree.sh cmd_merge () { · line 984

Quoted 10 lines
contrib/subtree/git-subtree.sh +2 -2
 	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".

#2 lore raw
In reply to Thomas Koutcher via GitGitGadget
Quoted 5 lines · Thomas Koutcher via GitGitGadget

From: Thomas Koutcher <[email protected]>

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.

Quoted 12 lines

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(-)
contrib/subtree/git-subtree.sh +0 -0
index 7f767b5c38f..de918d9fb05 100755

contrib/subtree/git-subtree.sh cmd_merge () { · line 982

Quoted 9 lines
contrib/subtree/git-subtree.sh +2 -2
@@ -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 ...".

#3 lore raw

PATCH v2 1/1 subtree: force merge commit

In reply to Thomas Koutcher via GitGitGadget

From: Thomas Koutcher <[email protected]>

When merge.ff is set to only in .gitconfig, git subtree pull will fail with error fatal: Not possible to fast-forward, aborting., but the command does want to make merges in these places. Add --no-ff argument to git merge to enforce this behaviour.

---
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.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1139%2Fkoutcher%2Fsubtree-merge-ff-fix-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1139/koutcher/subtree-merge-ff-fix-v2
Pull-Request: https://github.com/git/git/pull/1139

Range-diff vs v1:

1: b03749fda76 ! 1: 765fea3e26c subtree: ignore merge.ff setting
@@ Metadata
Author: Thomas Koutcher <[email protected]>

## Commit message ##
- subtree: ignore merge.ff setting
+ subtree: force merge commit

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.
+ fail with error fatal: Not possible to fast-forward, aborting., but
+ the command does want to make merges in these places. Add --no-ff
+ argument to git merge to enforce this behaviour.

+ Reviewed-by: Ævar Arnfjörð Bjarmason <[email protected]>
+ Reviewed-by: Junio C Hamano <[email protected]>

## contrib/subtree/git-subtree.sh ##
@@ contrib/subtree/git-subtree.sh: cmd_merge () {
if test -n "$arg_addmerge_message"
then
- git merge -Xsubtree="$arg_prefix" \
-+ git -c merge.ff= merge -Xsubtree="$arg_prefix" \
++ git merge --no-ff -Xsubtree="$arg_prefix" \
--message="$arg_addmerge_message" "$rev"
else
- git merge -Xsubtree="$arg_prefix" $rev
-+ git -c merge.ff= merge -Xsubtree="$arg_prefix" $rev
++ git merge --no-ff -Xsubtree="$arg_prefix" $rev
fi
}

 contrib/subtree/git-subtree.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/subtree/git-subtree.sh +2 -2
index 7f767b5c38f..cb51aee4cbf 100755
@@ -976,10 +976,10 @@ cmd_merge () {
 
 	if test -n "$arg_addmerge_message"
 	then
-		git merge -Xsubtree="$arg_prefix" \
+		git merge --no-ff -Xsubtree="$arg_prefix" \
 			--message="$arg_addmerge_message" "$rev"
 	else
-		git merge -Xsubtree="$arg_prefix" $rev
+		git merge --no-ff -Xsubtree="$arg_prefix" $rev
 	fi
 }
 

base-commit: 5fbd2fc5997dfa4d4593a862fe729b1e7a89bcf8

Signature · 1 line
gitgitgadget
#4 lore raw

Re: [PATCH v2] subtree: force merge commit

Quoted 9 lines · Thomas Koutcher via GitGitGadget

From: Thomas Koutcher <[email protected]>

When merge.ff is set to only in .gitconfig, git subtree pull will fail with error fatal: Not possible to fast-forward, aborting., but the command does want to make merges in these places. Add --no-ff argument to git merge to enforce this behaviour.

Reviewed-by: is a bit tricky. If you are sending a corrected version after other people just took a look at a previous iteration, you cannot generally have them for two reasons. First of all, they haven't said that you can have Reviewed-by: under there name (which means that they are completely satisfied after giving a thorough analysis). Also, the version you are sending is different from what they reviewed, so even if they were happy with the previous iteration, it does not mean they would be with this version.

Quoted 6 lines
contrib/subtree/git-subtree.sh +0 -0
index 7f767b5c38f..cb51aee4cbf 100755
@@ -976,10 +976,10 @@ cmd_merge () {
 

contrib/subtree/git-subtree.sh cmd_merge () { · line 984

Quoted 10 lines
contrib/subtree/git-subtree.sh +2 -2
 	if test -n "$arg_addmerge_message"
 	then
-		git merge -Xsubtree="$arg_prefix" \
+		git merge --no-ff -Xsubtree="$arg_prefix" \
 			--message="$arg_addmerge_message" "$rev"
 	else
-		git merge -Xsubtree="$arg_prefix" $rev
+		git merge --no-ff -Xsubtree="$arg_prefix" $rev
 	fi
 }

Thanks. I'll drop these two reviewed-by lines while queuing.

#5 lore raw

Re: [PATCH v2] subtree: force merge commit

Le 18/11/2021 à 05:53, Junio C Hamano a écrit :

Quoted 8 lines

Reviewed-by: is a bit tricky. If you are sending a corrected version after other people just took a look at a previous iteration, you cannot generally have them for two reasons. First of all, they haven't said that you can have Reviewed-by: under there name (which means that they are completely satisfied after giving a thorough analysis). Also, the version you are sending is different from what they reviewed, so even if they were happy with the previous iteration, it does not mean they would be with this version.

Thanks for the clarification and sorry for the confusion I created.

#6 lore raw

PATCH RESEND 1/1 subtree: force merge commit

In reply to Junio C Hamano

From: Thomas Koutcher <[email protected]>

When merge.ff is set to only in .gitconfig, git subtree pull will fail with error fatal: Not possible to fast-forward, aborting., but the command does want to make merges in these places. Add --no-ff argument to git merge to enforce this behaviour.

---

I think this was meant to be queued but forgotten.

Quoted 1 line · Junio C Hamano

Thanks. I'll drop these two reviewed-by lines while queuing.

Changes since v2: removed/added reviewed-by trailer

BTW is there a good way to tell "git send-email --in-reply-to" to prefill "To:" and "Cc:" based on the message I'm replying to?

 contrib/subtree/git-subtree.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/subtree/git-subtree.sh +2 -2
index 71f1fd94bd..1af1d9653e 100755
@@ -975,10 +975,10 @@ cmd_merge () {
 
 	if test -n "$arg_addmerge_message"
 	then
-		git merge -Xsubtree="$arg_prefix" \
+		git merge --no-ff -Xsubtree="$arg_prefix" \
 			--message="$arg_addmerge_message" "$rev"
 	else
-		git merge -Xsubtree="$arg_prefix" $rev
+		git merge --no-ff -Xsubtree="$arg_prefix" $rev
 	fi
 }
 
Signature · 1 line
2.35.0.295.gee0e44bcb6
#7 lore raw

Re: [PATCH RESEND] subtree: force merge commit

Quoted 2 lines · Johannes Altmanninger

BTW is there a good way to tell "git send-email --in-reply-to" to prefill "To:" and "Cc:" based on the message I'm replying to?

I do not think there is, and I do not think it is readily feasible. Given a message ID, how would you figure out these two values? Hardcode the URL of mailing list archive and the rules to find these values given a message ID? What if you have a local mail archive that you'd rather use instead of going to the public internet?

#8 lore raw

Re: [PATCH RESEND] subtree: force merge commit

Quoted 10 lines · Junio C Hamano
Quoted 2 lines · Johannes Altmanninger

BTW is there a good way to tell "git send-email --in-reply-to" to prefill "To:" and "Cc:" based on the message I'm replying to?

I do not think there is, and I do not think it is readily feasible. Given a message ID, how would you figure out these two values? Hardcode the URL of mailing list archive and the rules to find these values given a message ID? What if you have a local mail archive that you'd rather use instead of going to the public internet?

The "b4" tool accepts message IDs and allows to configure how to look up message contents. This is the default:

[b4]
# Where to look up threads by message id
midmask = https://lore.kernel.org/r/%s

b4 has some powerful features but I think I just want something that reads an email on stdin and outputs the appropriate "send-email --in-reply-to" command. I'll probably parse the mail headers myself.

#9 lore raw

Re: [PATCH RESEND] subtree: force merge commit

Quoted 15 lines · Johannes Altmanninger
Quoted 10 lines · Junio C Hamano
Quoted 2 lines · Johannes Altmanninger

BTW is there a good way to tell "git send-email --in-reply-to" to prefill "To:" and "Cc:" based on the message I'm replying to?

I do not think there is, and I do not think it is readily feasible. Given a message ID, how would you figure out these two values? Hardcode the URL of mailing list archive and the rules to find these values given a message ID? What if you have a local mail archive that you'd rather use instead of going to the public internet?

The "b4" tool accepts message IDs and allows to configure how to look up message contents. This is the default:

Quoted 7 lines

[b4]
# Where to look up threads by message id
midmask = https://lore.kernel.org/r/%s

b4 has some powerful features but I think I just want something that reads an email on stdin and outputs the appropriate "send-email --in-reply-to" command. I'll probably parse the mail headers myself.

I know about "b4" and use it myself, but so what? "git" is used by a lot wider audience than those who can fetch patches from k.org.

So, I think it still is correct to say that it is not readily feasible, without telling the command ways to turn a message-ID into to/cc addresses.