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

cg-fetch auto-following tags

From
Junio C Hamano <junkio@cox.net>
Date
Oct 16, 2005, 00:58 UTC
Message-ID
<7vfyr2i8fv.fsf@assigned-by-dhcp.cox.net>
In cg-fetch, you have some code at the bottom starting with:
	$get -i -s -u -d "$uri/refs/tags" "$_git/refs/tags" || rsyncerr=1

Under http, I presume get is get_http which is recursive wget to slurp all tags to .git/refs/tags?

Earlier you were talking about fetching tags automatically as the user follows a branch (or multiple branches) development, but the current git-http-fetch's semantics of making sure the repository has all the reachable objects when slurping from a ref makes it impossible, and you are playing things safer by essentially cloning the remote repository.

The latest "master" branch of git-core sends unwrapped tag information to make this easier to implement. I think you should be able to do something like this (between "FIXME: Warn about conflicting tag names?" and "rm fetch-$name-dirty").

        git-ls-remote --tags $uri/ |
	# SHA1 refs/tags/v0.99.8^{} --> SHA1 tags/v0.99.8
	# where SHA1 is the object v0.99.8 tag points at.
        sed -ne 's:\([^	]\)	refs/\(tags/.*\)^{}$:\1	\2:p' |
        while read sha1 tagname
        do
		# do we have the object pointed at by the tag?
                git-cat-file -t "$sha1" >/dev/null 2>&1 ||
                continue
                # if so, fetch the tag -- which should be a
                # cheap operation -- to complete the chain.
                $fetch "$tagname" "$uri" "$tagname"
        done

This sample code assumes your $fetch implements the same semantics for various transports ($1 is the ref to fetch, $2 is the repo url, $3 is the local ref to write into); I only checked http transport in your code.

Message 1 of 1 in “cg-fetch auto-following tags”
  1. Junio C HamanoOct 16, 2005

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.