diff mbox series

[RESEND] subtree: force merge commit

Message ID 20220201172601.262718-1-aclopte@gmail.com (mailing list archive)
State Accepted
Commit 9158a3564a970def3375a79e8f3f90927cd8e793
Headers show
Series [RESEND] subtree: force merge commit | expand

Commit Message

Johannes Altmanninger Feb. 1, 2022, 5:26 p.m. UTC
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.`, but
the command does want to make merges in these places. Add `--no-ff`
argument to `git merge` to enforce this behaviour.

Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
Reviewed-by: Johannes Altmanninger <aclopte@gmail.com>
---

I think this was meant to be queued but forgotten.

Junio C Hamano <gitster@pobox.com> writes:

> 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(-)

Comments

Junio C Hamano Feb. 1, 2022, 7:19 p.m. UTC | #1
Johannes Altmanninger <aclopte@gmail.com> writes:

> 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?
Johannes Altmanninger Feb. 1, 2022, 7:53 p.m. UTC | #2
On Tue, Feb 01, 2022 at 11:19:45AM -0800, Junio C Hamano wrote:
> Johannes Altmanninger <aclopte@gmail.com> writes:
> 
> > 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.
Junio C Hamano Feb. 1, 2022, 11:20 p.m. UTC | #3
Johannes Altmanninger <aclopte@gmail.com> writes:

> On Tue, Feb 01, 2022 at 11:19:45AM -0800, Junio C Hamano wrote:
>> Johannes Altmanninger <aclopte@gmail.com> writes:
>> 
>> > 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.

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.
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 71f1fd94bd..1af1d9653e 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -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
 }