Skip to content

Commit

Permalink
octopus: reenable fast-forward merges
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stephen Boyd authored and Junio C Hamano committed Dec 14, 2009
1 parent 8133450 commit 85bf49f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-merge-octopus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions t/t7602-merge-octopus-many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 85bf49f

Please sign in to comment.