git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] subtree: ignore merge.ff setting
@ 2021-11-14 15:07 Thomas Koutcher via GitGitGadget
  2021-11-14 17:54 ` Ævar Arnfjörð Bjarmason
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Thomas Koutcher via GitGitGadget @ 2021-11-14 15:07 UTC (permalink / raw)
  To: git; +Cc: Thomas Koutcher, Thomas Koutcher

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
 }
 

base-commit: 5fbd2fc5997dfa4d4593a862fe729b1e7a89bcf8
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] subtree: ignore merge.ff setting
  2021-11-14 15:07 [PATCH] subtree: ignore merge.ff setting Thomas Koutcher via GitGitGadget
@ 2021-11-14 17:54 ` Ævar Arnfjörð Bjarmason
  2021-11-14 18:38 ` Junio C Hamano
  2021-11-14 21:45 ` [PATCH v2] subtree: force merge commit Thomas Koutcher via GitGitGadget
  2 siblings, 0 replies; 10+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-11-14 17:54 UTC (permalink / raw)
  To: Thomas Koutcher via GitGitGadget; +Cc: git, Thomas Koutcher


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] subtree: ignore merge.ff setting
  2021-11-14 15:07 [PATCH] subtree: ignore merge.ff setting Thomas Koutcher via GitGitGadget
  2021-11-14 17:54 ` Ævar Arnfjörð Bjarmason
@ 2021-11-14 18:38 ` Junio C Hamano
  2021-11-14 21:45 ` [PATCH v2] subtree: force merge commit Thomas Koutcher via GitGitGadget
  2 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2021-11-14 18:38 UTC (permalink / raw)
  To: Thomas Koutcher via GitGitGadget; +Cc: git, Thomas Koutcher

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] subtree: force merge commit
  2021-11-14 15:07 [PATCH] subtree: ignore merge.ff setting Thomas Koutcher via GitGitGadget
  2021-11-14 17:54 ` Ævar Arnfjörð Bjarmason
  2021-11-14 18:38 ` Junio C Hamano
@ 2021-11-14 21:45 ` Thomas Koutcher via GitGitGadget
  2021-11-18  4:53   ` Junio C Hamano
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Koutcher via GitGitGadget @ 2021-11-14 21:45 UTC (permalink / raw)
  To: git
  Cc: Ævar Arnfjörð Bjarmason, Thomas Koutcher,
	Thomas Koutcher

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.

Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Junio C Hamano <gitster@pobox.com>
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-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 <thomas.koutcher@online.fr>
      
       ## 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 <avarab@gmail.com>
     +    Reviewed-by: Junio C Hamano <gitster@pobox.com>
          Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
      
       ## 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(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 7f767b5c38f..cb51aee4cbf 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 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
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] subtree: force merge commit
  2021-11-14 21:45 ` [PATCH v2] subtree: force merge commit Thomas Koutcher via GitGitGadget
@ 2021-11-18  4:53   ` Junio C Hamano
  2021-11-18  6:06     ` Thomas Koutcher
  2022-02-01 17:26     ` [PATCH RESEND] " Johannes Altmanninger
  0 siblings, 2 replies; 10+ messages in thread
From: Junio C Hamano @ 2021-11-18  4:53 UTC (permalink / raw)
  To: Thomas Koutcher via GitGitGadget
  Cc: git, Ævar Arnfjörð Bjarmason, Thomas Koutcher

"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.`, 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 <avarab@gmail.com>
> Reviewed-by: Junio C Hamano <gitster@pobox.com>

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.

> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 7f767b5c38f..cb51aee4cbf 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 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] subtree: force merge commit
  2021-11-18  4:53   ` Junio C Hamano
@ 2021-11-18  6:06     ` Thomas Koutcher
  2022-02-01 17:26     ` [PATCH RESEND] " Johannes Altmanninger
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Koutcher @ 2021-11-18  6:06 UTC (permalink / raw)
  To: git

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

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH RESEND] subtree: force merge commit
  2021-11-18  4:53   ` Junio C Hamano
  2021-11-18  6:06     ` Thomas Koutcher
@ 2022-02-01 17:26     ` Johannes Altmanninger
  2022-02-01 19:19       ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: Johannes Altmanninger @ 2022-02-01 17:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Thomas Koutcher, Johannes Altmanninger

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

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
 }
 
-- 
2.35.0.295.gee0e44bcb6


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RESEND] subtree: force merge commit
  2022-02-01 17:26     ` [PATCH RESEND] " Johannes Altmanninger
@ 2022-02-01 19:19       ` Junio C Hamano
  2022-02-01 19:53         ` Johannes Altmanninger
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2022-02-01 19:19 UTC (permalink / raw)
  To: Johannes Altmanninger; +Cc: git, Thomas Koutcher

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?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RESEND] subtree: force merge commit
  2022-02-01 19:19       ` Junio C Hamano
@ 2022-02-01 19:53         ` Johannes Altmanninger
  2022-02-01 23:20           ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Altmanninger @ 2022-02-01 19:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Thomas Koutcher

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RESEND] subtree: force merge commit
  2022-02-01 19:53         ` Johannes Altmanninger
@ 2022-02-01 23:20           ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2022-02-01 23:20 UTC (permalink / raw)
  To: Johannes Altmanninger; +Cc: git, Thomas Koutcher

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-02-01 23:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-14 15:07 [PATCH] subtree: ignore merge.ff setting Thomas Koutcher via GitGitGadget
2021-11-14 17:54 ` Ævar Arnfjörð Bjarmason
2021-11-14 18:38 ` Junio C Hamano
2021-11-14 21:45 ` [PATCH v2] subtree: force merge commit Thomas Koutcher via GitGitGadget
2021-11-18  4:53   ` Junio C Hamano
2021-11-18  6:06     ` Thomas Koutcher
2022-02-01 17:26     ` [PATCH RESEND] " Johannes Altmanninger
2022-02-01 19:19       ` Junio C Hamano
2022-02-01 19:53         ` Johannes Altmanninger
2022-02-01 23:20           ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).