[PATCH v2] subtree: force merge commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thomas Koutcher <thomas.koutcher@xxxxxxxxx>

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@xxxxxxxxx>
Reviewed-by: Junio C Hamano <gitster@xxxxxxxxx>
Signed-off-by: Thomas Koutcher <thomas.koutcher@xxxxxxxxx>
---
    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@xxxxxxxxx

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@xxxxxxxxx>
      
       ## 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@xxxxxxxxx>
     +    Reviewed-by: Junio C Hamano <gitster@xxxxxxxxx>
          Signed-off-by: Thomas Koutcher <thomas.koutcher@xxxxxxxxx>
      
       ## 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux