diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-08-17 02:04:43 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-18 14:02:04 -0700 |
commit | 13dd255e4abb95895aaef72e2b93564be90cb49c (patch) | |
tree | 5e72670ec392f0da99883a4a18312763f3dbe6cd /contrib/examples | |
parent | merge script: refuse to merge during merge (diff) | |
download | tgif-13dd255e4abb95895aaef72e2b93564be90cb49c.tar.xz |
merge script: improve log message subject
- point out remote-tracking branches as "remote branch
'upstream/master'";
- avoid misleading log messages when a tag and branch
share a name.
This approximates the builtin merge command's behavior well
enough to pass the relevant tests.
Based roughly on v1.6.4.2~10^2 (merge: indicate remote tracking
branches in merge message, 2009-08-09) and v1.6.4.2~10^2~1 (merge: fix
incorrect merge message for ambiguous tag/branch, 2009-08-09).
Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/examples')
-rwxr-xr-x | contrib/examples/git-merge.sh | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh index 50042df1b9..d491566660 100755 --- a/contrib/examples/git-merge.sh +++ b/contrib/examples/git-merge.sh @@ -134,21 +134,32 @@ finish () { 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]*$') && + if truname=$(expr "$remote" : '\(.*\)~[0-9]*$') && git show-ref -q --verify "refs/heads/$truname" 2>/dev/null then echo "$rh branch '$truname' (early part) of ." - elif test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD" + return + fi + if found_ref=$(git rev-parse --symbolic-full-name --verify \ + "$remote" 2>/dev/null) + then + if test "${found_ref#refs/heads/}" != "$found_ref" + then + echo "$rh branch '$remote' of ." + return + elif test "${found_ref#refs/remotes/}" != "$found_ref" + then + echo "$rh remote branch '$remote' of ." + return + fi + fi + if test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD" then sed -e 's/ not-for-merge / /' -e 1q \ "$GIT_DIR/FETCH_HEAD" - else - echo "$rh commit '$remote'" + return fi + echo "$rh commit '$remote'" } parse_config () { |