Skip to content

Commit 85bf49f

Browse files
bebarinogitster
authored andcommitted
octopus: reenable fast-forward merges
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8133450 commit 85bf49f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

git-merge-octopus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ esac
4444
# MRC is the current "merge reference commit"
4545
# MRT is the current "merge result tree"
4646

47-
MRC=$head MSG= PARENT="-p $head"
47+
MRC=$(git rev-parse --verify -q $head) MSG= PARENT="-p $head"
4848
MRT=$(git write-tree)
4949
CNT=1 ;# counting our head
5050
NON_FF_MERGE=0

t/t7602-merge-octopus-many.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,22 @@ test_expect_success 'merge up-to-date output uses pretty names' '
8282
git merge c4 c5 >actual &&
8383
test_cmp actual expected
8484
'
85+
86+
cat >expected <<\EOF
87+
Fast-forwarding to: c1
88+
Trying simple merge with c2
89+
Merge made by octopus.
90+
c1.c | 1 +
91+
c2.c | 1 +
92+
2 files changed, 2 insertions(+), 0 deletions(-)
93+
create mode 100644 c1.c
94+
create mode 100644 c2.c
95+
EOF
96+
97+
test_expect_success 'merge fast-forward output uses pretty names' '
98+
git reset --hard c0 &&
99+
git merge c1 c2 >actual &&
100+
test_cmp actual expected
101+
'
102+
85103
test_done

0 commit comments

Comments
 (0)