Skip to content

Commit 3683dc5

Browse files
author
Junio C Hamano
committed
git-merge: fix confusion between tag and branch
In a repository with core.warnambiguousrefs turned off, and with a branch and a tag that have the same name 'frotz', git merge frotz would merge the commit pointed at by the tag 'frotz' but incorrectly would identify what was merged as 'branch frotz' in the merge message. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 22b1c7e commit 3683dc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git-merge.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ else
189189
merge_name=$(for remote
190190
do
191191
rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) &&
192-
if git show-ref -q --verify "refs/heads/$remote"
192+
bh=$(git show-ref -s --verify "refs/heads/$remote") &&
193+
if test "$rh" = "$bh"
193194
then
194-
what=branch
195+
echo "$rh branch '$remote' of ."
195196
else
196-
what=commit
197-
fi &&
198-
echo "$rh $what '$remote'"
197+
echo "$rh commit '$remote'"
198+
fi
199199
done | git-fmt-merge-msg
200200
)
201201
merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"

0 commit comments

Comments
 (0)