Skip to content

Commit

Permalink
octopus: make merge process simpler to follow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Boyd authored and Junio C Hamano committed Dec 14, 2009
1 parent 9861b64 commit 8133450
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
9 changes: 5 additions & 4 deletions git-merge-octopus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ do
exit 2
esac

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

case "$LF$common$LF" in
*"$LF$SHA1$LF"*)
echo "Already up-to-date with $SHA1"
echo "Already up-to-date with $pretty_name"
continue
;;
esac
Expand All @@ -81,15 +82,15 @@ do
# tree as the intermediate result of the merge.
# We still need to count this as part of the parent set.

echo "Fast forwarding to: $SHA1"
echo "Fast-forwarding to: $pretty_name"
git read-tree -u -m $head $SHA1 || exit
MRC=$SHA1 MRT=$(git write-tree)
continue
fi

NON_FF_MERGE=1

echo "Trying simple merge with $SHA1"
echo "Trying simple merge with $pretty_name"
git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
next=$(git write-tree 2>/dev/null)
if test $? -ne 0
Expand Down
33 changes: 33 additions & 0 deletions t/t7602-merge-octopus-many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,37 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
done
'

cat >expected <<\EOF
Trying simple merge with c2
Trying simple merge with c3
Trying simple merge with c4
Merge made by octopus.
c2.c | 1 +
c3.c | 1 +
c4.c | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 c2.c
create mode 100644 c3.c
create mode 100644 c4.c
EOF

test_expect_success 'merge output uses pretty names' '
git reset --hard c1 &&
git merge c2 c3 c4 >actual &&
test_cmp actual expected
'

cat >expected <<\EOF
Already up-to-date with c4
Trying simple merge with c5
Merge made by octopus.
c5.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 c5.c
EOF

test_expect_success 'merge up-to-date output uses pretty names' '
git merge c4 c5 >actual &&
test_cmp actual expected
'
test_done

0 comments on commit 8133450

Please sign in to comment.