git-fetch: follow tag only when tracking remote branch.

Unless --no-tags flag was given, git-fetch tried to always
follow remote tags that point at the commits we picked up.

It is not very useful to pick up tags from remote unless storing
the fetched branch head in a local tracking branch.  This is
especially true if the fetch is done to merge the remote branch
into our current branch as one-shot basis (i.e. "please pull"),
and is even harmful if the remote repository has many irrelevant
tags.

This proposed update disables the automated tag following unless
we are storing the a fetched branch head in a local tracking
branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-02-22 13:10:37 -08:00
Родитель 183bdb2ccc
Коммит 6dc78e696b
1 изменённых файлов: 19 добавлений и 14 удалений

Просмотреть файл

@ -368,20 +368,25 @@ fetch_main "$reflist"
# automated tag following # automated tag following
case "$no_tags$tags" in case "$no_tags$tags" in
'') '')
taglist=$(IFS=" " && case "$reflist" in
git-ls-remote $upload_pack --tags "$remote" | *:refs/*)
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' | # effective only when we are following remote branch
while read sha1 name # using local tracking branch.
do taglist=$(IFS=" " &&
test -f "$GIT_DIR/$name" && continue git-ls-remote $upload_pack --tags "$remote" |
git-check-ref-format "$name" || { sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
echo >&2 "warning: tag ${name} ignored" while read sha1 name
continue do
} test -f "$GIT_DIR/$name" && continue
git-cat-file -t "$sha1" >/dev/null 2>&1 || continue git-check-ref-format "$name" || {
echo >&2 "Auto-following $name" echo >&2 "warning: tag ${name} ignored"
echo ".${name}:${name}" continue
done) }
git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
echo >&2 "Auto-following $name"
echo ".${name}:${name}"
done)
esac
case "$taglist" in case "$taglist" in
'') ;; '') ;;
?*) ?*)