Git development
 help / color / mirror / Atom feed
* cg-fetch auto-following tags
@ 2005-10-16  0:58 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-10-16  0:58 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-16  0:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-16  0:58 cg-fetch auto-following tags Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox