Skip to content

Commit 153559a

Browse files
committed
Merge branch 'sb/maint-octopus' into maint-1.6.5
* sb/maint-octopus: octopus: remove dead code octopus: reenable fast-forward merges octopus: make merge process simpler to follow
2 parents 4b68365 + f08aa01 commit 153559a

File tree

2 files changed

+57
-9
lines changed

2 files changed

+57
-9
lines changed

git-merge-octopus.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ 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)
4848
MRT=$(git write-tree)
49-
CNT=1 ;# counting our head
5049
NON_FF_MERGE=0
5150
OCTOPUS_FAILURE=0
5251
for SHA1 in $remotes
@@ -61,35 +60,33 @@ do
6160
exit 2
6261
esac
6362

63+
eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
6464
common=$(git merge-base --all $SHA1 $MRC) ||
65-
die "Unable to find common commit with $SHA1"
65+
die "Unable to find common commit with $pretty_name"
6666

6767
case "$LF$common$LF" in
6868
*"$LF$SHA1$LF"*)
69-
echo "Already up-to-date with $SHA1"
69+
echo "Already up-to-date with $pretty_name"
7070
continue
7171
;;
7272
esac
7373

74-
CNT=`expr $CNT + 1`
75-
PARENT="$PARENT -p $SHA1"
76-
7774
if test "$common,$NON_FF_MERGE" = "$MRC,0"
7875
then
7976
# The first head being merged was a fast-forward.
8077
# Advance MRC to the head being merged, and use that
8178
# tree as the intermediate result of the merge.
8279
# We still need to count this as part of the parent set.
8380

84-
echo "Fast forwarding to: $SHA1"
81+
echo "Fast-forwarding to: $pretty_name"
8582
git read-tree -u -m $head $SHA1 || exit
8683
MRC=$SHA1 MRT=$(git write-tree)
8784
continue
8885
fi
8986

9087
NON_FF_MERGE=1
9188

92-
echo "Trying simple merge with $SHA1"
89+
echo "Trying simple merge with $pretty_name"
9390
git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
9491
next=$(git write-tree 2>/dev/null)
9592
if test $? -ne 0

t/t7602-merge-octopus-many.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,55 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
4949
done
5050
'
5151

52+
cat >expected <<\EOF
53+
Trying simple merge with c2
54+
Trying simple merge with c3
55+
Trying simple merge with c4
56+
Merge made by octopus.
57+
c2.c | 1 +
58+
c3.c | 1 +
59+
c4.c | 1 +
60+
3 files changed, 3 insertions(+), 0 deletions(-)
61+
create mode 100644 c2.c
62+
create mode 100644 c3.c
63+
create mode 100644 c4.c
64+
EOF
65+
66+
test_expect_success 'merge output uses pretty names' '
67+
git reset --hard c1 &&
68+
git merge c2 c3 c4 >actual &&
69+
test_cmp actual expected
70+
'
71+
72+
cat >expected <<\EOF
73+
Already up-to-date with c4
74+
Trying simple merge with c5
75+
Merge made by octopus.
76+
c5.c | 1 +
77+
1 files changed, 1 insertions(+), 0 deletions(-)
78+
create mode 100644 c5.c
79+
EOF
80+
81+
test_expect_success 'merge up-to-date output uses pretty names' '
82+
git merge c4 c5 >actual &&
83+
test_cmp actual expected
84+
'
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+
52103
test_done

0 commit comments

Comments
 (0)