summaryrefslogtreecommitdiff
path: root/git-merge.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-16 12:31:45 -0800
committerJunio C Hamano <junkio@cox.net>2006-12-16 12:31:45 -0800
commitb1bfcae438adb485bb66e2f59396373809e346e6 (patch)
tree451de4a9e818681eb82cfb69442a8808e33f24fd /git-merge.sh
parent9abaa7f033283f84ba8372192f9d4a165fb09ce4 (diff)
downloadgit-b1bfcae438adb485bb66e2f59396373809e346e6.tar.gz
merge: give a bit prettier merge message to "merge branch~$n"
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>
Diffstat (limited to 'git-merge.sh')
-rwxr-xr-xgit-merge.sh26
1 files changed, 17 insertions, 9 deletions
diff --git a/git-merge.sh b/git-merge.sh
index c895a04f6b..4ebfcf65d9 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -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=
@@ -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"