git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-pull and tag objects

From
Junio C Hamano <junkio@cox.net>
Date
Feb 11, 2007, 21:41 UTC
Message-ID
<7v3b5ce5j0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0702111124410.8424@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 7 quoted lines
> On Sun, 11 Feb 2007, Junio C Hamano wrote:
>> 
>> Well, what you are saying is that it used to be Ok in Jul 5 2005
>> version but with tag following it is not Ok anymore, isn't it?
>
> Do we actually do it with automatic tag following? I tested, and it didn't 
> do anything bad for me.
You are right.

The only iffy case that is remaining is "git fetch --tags $URL". The user is explicitly saying "I want all tags from there", but the user may not be expecting tags that are already present in the local repository to be overwritten.

The filtering on the auto-follow codepath Johannes added with "git-show-ref --exclude-existing" would fix this case as well.

-- >8 -- [PATCH] "git-fetch --tags $URL" should not overwrite existing tags

Use the same --exclude-existing filter as we use for automatic tag following to avoid overwriting existing tags with replacement ones the other side created.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-fetch.sh b/git-fetch.sh
index 357cac2..ca984e7 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -253,23 +253,10 @@ if test "$tags"
 then
 	taglist=`IFS='	' &&
 		  echo "$ls_remote_result" |
+		  git-show-ref --exclude-existing=refs/tags/ |
 	          while read sha1 name
 		  do
-			case "$sha1" in
-			fail)
-				exit 1
-			esac
-			case "$name" in
-			*^*) continue ;;
-			refs/tags/*) ;;
-			*) continue ;;
-			esac
-		  	if git-check-ref-format "$name"
-			then
-			    echo ".${name}:${name}"
-			else
-			    echo >&2 "warning: tag ${name} ignored"
-			fi
+			echo ".${name}:${name}"
 		  done` || exit
 	if test "$#" -gt 1
 	then
Previous: Linus TorvaldsNext: Theodore Tso
Message 18 of 26 in “git-pull and tag objects”
  1. Alex BenneeFeb 8, 2007
  2. Alex RiesenFeb 9, 2007
  3. Junio C HamanoFeb 9, 2007
  4. git-fetch: document automatic tag following.Junio C Hamano, Feb 10, 2007
  5. Theodore TsoFeb 10, 2007
  6. Linus TorvaldsFeb 10, 2007
  7. Jakub NarebskiFeb 10, 2007
  8. Linus TorvaldsFeb 10, 2007
  9. Junio C HamanoFeb 11, 2007
  10. Jakub NarebskiFeb 12, 2007
  11. Theodore TsoFeb 11, 2007
  12. Linus TorvaldsFeb 11, 2007
  13. Junio C HamanoFeb 11, 2007
  14. Linus TorvaldsFeb 11, 2007
  15. Junio C HamanoFeb 11, 2007
  16. Junio C HamanoFeb 11, 2007
  17. Linus TorvaldsFeb 11, 2007
  18. Junio C HamanoFeb 11, 2007
  19. Theodore TsoFeb 12, 2007
  20. Junio C HamanoFeb 13, 2007
  21. Linus TorvaldsFeb 14, 2007
  22. Junio C HamanoFeb 14, 2007
  23. Johannes SchindelinFeb 14, 2007
  24. Linus TorvaldsFeb 14, 2007
  25. Jakub NarebskiFeb 15, 2007
  26. Johannes SchindelinFeb 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.