git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] octopus: reenable fast-forward merges

From
Stephen Boyd <bebarino@gmail.com>
Date
Dec 12, 2009, 00:38 UTC
Message-ID
<1260578339-30750-2-git-send-email-bebarino@gmail.com>
In-Reply-To
<87zl5p1gsp.fsf@jondo.cante.net>

The fast-forward logic is never being triggered because $common and $MRC are never equivalent. $common is initialized to a commit id by merge-base and MRC is initialized to HEAD. Fix this by initializing $MRC to the commit id for HEAD so that its possible for $MRC and $common to be equal.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
Found this while making tests up for part 1 of this series.
 git-merge-octopus.sh          |    2 +-
 t/t7602-merge-octopus-many.sh |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh
index 1c8ee0a..99b6f8a 100755
--- a/git-merge-octopus.sh
+++ b/git-merge-octopus.sh
@@ -44,7 +44,7 @@ esac
 # MRC is the current "merge reference commit"
 # MRT is the current "merge result tree"
 
-MRC=$head MSG= PARENT="-p $head"
+MRC=$(git rev-parse --verify -q $head) MSG= PARENT="-p $head"
 MRT=$(git write-tree)
 CNT=1 ;# counting our head
 NON_FF_MERGE=0
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 7377033..2746169 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -82,4 +82,22 @@ test_expect_success 'merge up-to-date output uses pretty names' '
 	git merge c4 c5 >actual &&
 	test_cmp actual expected
 '
+
+cat >expected <<\EOF
+Fast-forwarding to: c1
+Trying simple merge with c2
+Merge made by octopus.
+ c1.c |    1 +
+ c2.c |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 c1.c
+ create mode 100644 c2.c
+EOF
+
+test_expect_success 'merge fast-forward output uses pretty names' '
+	git reset --hard c0 &&
+	git merge c1 c2 >actual &&
+	test_cmp actual expected
+'
+
 test_done
-- 
1.6.6.rc1.45.g9aadbb
Previous: Stephen BoydNext: Stephen Boyd
Message 10 of 14 in “FEATURE REQUEST: Announce branch name with merge comamnd”
  1. Jari AaltoDec 11, 2009
  2. Junio C HamanoDec 11, 2009
  3. 1/3 octopus: make merge process simpler to followStephen Boyd, Dec 12, 2009
  4. Junio C HamanoDec 12, 2009
  5. Johannes SixtDec 12, 2009
  6. Junio C HamanoDec 12, 2009
  7. octopus: make merge process simpler to followStephen Boyd, Dec 15, 2009
  8. Junio C HamanoDec 15, 2009
  9. Stephen BoydDec 15, 2009
  10. 2/3 octopus: reenable fast-forward mergesStephen Boyd, Dec 12, 2009
  11. 3/3 octopus: remove dead codeStephen Boyd, Dec 12, 2009
  12. Junio C HamanoDec 12, 2009
  13. Alex RiesenDec 12, 2009
  14. Jari AaltoDec 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.