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

Re: Pulling tags from git.git

From
Junio C Hamano <junkio@cox.net>
Date
Mar 7, 2006, 10:33 UTC
Message-ID
<7voe0ilf25.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<440D5285.3050401@op5.se>
Andreas Ericsson <ae@op5.se> writes:
> With the git or git+ssh protocol, tags will be autofollowed
> when you do a pull (only signed tags, I think).  The
> auto-following is done by detecting tags that are fetched,

Ah, you are correct. We do not follow lightweight tags; I am not sure if we should.

We detect from ls-remote output if you have objects pointed by remote tags (either signed or unsigned -- we cannot tell it from ls-remote output) and fetch those tags that point at what we have.

The auto following is done only when you are tracking remote branches, BTW. Promiscuous fetch for immediate merging does not follow tags.

Totally untested, so if somebody is interested, please test it, and if it works, sign it off and bounce it back to me ;-).

-- >8 -- [PATCH] make "git fetch" follow unannotated tags as well.

---
diff --git a/git-fetch.sh b/git-fetch.sh
index 0346d4a..90c8882 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -375,7 +375,7 @@ case "$no_tags$tags" in
 		# using local tracking branch.
 		taglist=$(IFS=" " &&
 		git-ls-remote $upload_pack --tags "$remote" |
-		sed -ne 's|^\([0-9a-f]*\)[ 	]\(refs/tags/.*\)^{}$|\1 \2|p' |
+		sed -e 's/\^{}$//' -e 's/	/ /' |
 		while read sha1 name
 		do
 			test -f "$GIT_DIR/$name" && continue
@@ -386,7 +386,8 @@ case "$no_tags$tags" in
 			git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
 			echo >&2 "Auto-following $name"
 			echo ".${name}:${name}"
-		done)
+		done |
+		sort -u)
 	esac
 	case "$taglist" in
 	'') ;;
Previous: Andreas EricssonNext: Andreas Ericsson
Message 4 of 15 in “Pulling tags from git.git”
  1. David HoMar 6, 2006
  2. David HoMar 6, 2006
  3. Andreas EricssonMar 7, 2006
  4. Junio C HamanoMar 7, 2006
  5. Andreas EricssonMar 7, 2006
  6. A Large Angry SCMMar 7, 2006
  7. Andreas EricssonMar 7, 2006
  8. Junio C HamanoMar 7, 2006
  9. A Large Angry SCMMar 8, 2006
  10. Andreas EricssonMar 8, 2006
  11. Florian WeimerMar 9, 2006
  12. Andreas EricssonMar 9, 2006
  13. Florian WeimerMar 20, 2006
  14. Junio C HamanoMar 20, 2006
  15. David HoMar 7, 2006

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.