Skip to content

Commit 8133450

Browse files
bebarinogitster
authored andcommitted
octopus: make merge process simpler to follow
Its not very easy to understand what heads are being merged given the current output of an octopus merge. Fix this by replacing the sha1 with the (usually) better description in GITHEAD_<SHA1>. Suggested-by: Jari Aalto <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9861b64 commit 8133450

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

git-merge-octopus.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ do
6161
exit 2
6262
esac
6363

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

6768
case "$LF$common$LF" in
6869
*"$LF$SHA1$LF"*)
69-
echo "Already up-to-date with $SHA1"
70+
echo "Already up-to-date with $pretty_name"
7071
continue
7172
;;
7273
esac
@@ -81,15 +82,15 @@ do
8182
# tree as the intermediate result of the merge.
8283
# We still need to count this as part of the parent set.
8384

84-
echo "Fast forwarding to: $SHA1"
85+
echo "Fast-forwarding to: $pretty_name"
8586
git read-tree -u -m $head $SHA1 || exit
8687
MRC=$SHA1 MRT=$(git write-tree)
8788
continue
8889
fi
8990

9091
NON_FF_MERGE=1
9192

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

t/t7602-merge-octopus-many.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,37 @@ 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+
'
5285
test_done

0 commit comments

Comments
 (0)