Skip to content

Commit

Permalink
merge: give a bit prettier merge message to "merge branch~$n"
Browse files Browse the repository at this point in the history
This hacks the input to fmt-merge-msg to make the message for
merging early part of a branch a little easier to read.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Dec 16, 2006
1 parent 9abaa7f commit b1bfcae
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ finish () {
esac
}

merge_name () {
remote="$1"
rh=$(git-rev-parse --verify "$remote^0" 2>/dev/null) || return
bh=$(git-show-ref -s --verify "refs/heads/$remote" 2>/dev/null)
if test "$rh" = "$bh"
then
echo "$rh branch '$remote' of ."
elif truname=$(expr "$remote" : '\(.*\)~[1-9][0-9]*$') &&
git-show-ref -q --verify "refs/heads/$truname" 2>/dev/null
then
echo "$rh branch '$truname' (early part) of ."
else
echo "$rh commit '$remote'"
fi
}

case "$#" in 0) usage ;; esac

rloga= have_message=
Expand Down Expand Up @@ -188,15 +204,7 @@ else
# in this loop.
merge_name=$(for remote
do
rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) ||
continue ;# not something we can merge
bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null)
if test "$rh" = "$bh"
then
echo "$rh branch '$remote' of ."
else
echo "$rh commit '$remote'"
fi
merge_name "$remote"
done | git-fmt-merge-msg
)
merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"
Expand Down

0 comments on commit b1bfcae

Please sign in to comment.