@matheusbsbs / matheus-bagliano / commits / 81334502ee
Fork 0

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 <jari.aalto@cante.net> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Boyd committed Dec 11, 2009 at 16:38 UTC 81334502eed1c78f49fc74936b712b3cf32b682a
2 files changed +38 -4
git-merge-octopus.sh
+5 -4
@@ -61,12 +61,13 @@ do
61 exit 2
62 esac
63
64 + eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
65 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"
67
68 case "$LF$common$LF" in
69 *"$LF$SHA1$LF"*)
69 - echo "Already up-to-date with $SHA1"
70 + echo "Already up-to-date with $pretty_name"
71 continue
72 ;;
73 esac
@@ -81,7 +82,7 @@ do
82 # tree as the intermediate result of the merge.
83 # We still need to count this as part of the parent set.
84
84 - echo "Fast forwarding to: $SHA1"
85 + echo "Fast-forwarding to: $pretty_name"
86 git read-tree -u -m $head $SHA1 || exit
87 MRC=$SHA1 MRT=$(git write-tree)
88 continue
@@ -89,7 +90,7 @@ do
90
91 NON_FF_MERGE=1
92
92 - echo "Trying simple merge with $SHA1"
93 + echo "Trying simple merge with $pretty_name"
94 git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
95 next=$(git write-tree 2>/dev/null)
96 if test $? -ne 0
t/t7602-merge-octopus-many.sh
+33
@@ -49,4 +49,37 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
49 done
50 '
51
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 test_done