[PATCH] cogito-0.17.3 unable to parse tags from (recent?) git versions

Nix nix at esperi.org.uk
Sun Jul 2 05:17:53 PDT 2006


On Sun, 2 Jul 2006, Francois Romieu noted:
> Nix <nix at esperi.org.uk> :
> [...]
> 
> $ git --version
> git version 1.3.1
> $ git ls-remote --tags git://anongit.freedesktop.org/git/xorg/lib/libXvMC
> e484c0bbea8a9b5d56a6e48ab07f2a1e49e71300	refs/tags/before_20040421_xprint_branch_landing
> 378ff9f6bbd8157646dcba33ca81f38e3e33e346	refs/tags/CYGWIN-6_8_0-MERGE
> 378ff9f6bbd8157646dcba33ca81f38e3e33e346	refs/tags/CYGWIN-6_8_1-MERGE
> 378ff9f6bbd8157646dcba33ca81f38e3e33e346	refs/tags/CYGWIN-6_8_2-MERGE
> [snip]
> 58fde9acdcc6256917089271537017dc28710988	refs/tags/xprint_packagertest_20041217_base
> 
> $ git clone git://anongit.freedesktop.org/git/xorg/lib/libXvMC
> $ git ls-remote --tags .
> [lotsoftags]

Aha, it's Cogito. cogito clone isn't fetching the tags (which is odd:
it's always done so for me with other repos, but that was pre-upgrade to
0.17.3 and pre-git-upgrade to 1.4.0). I wonder how to convince it to do
so...

... aha, it parses git-ls-remote output and gets it wrong: tags from
git-ls-tags as of git-1.4.x don't have ^{} on their ends; in fact even
tracking back to 2005 I can't find a time when that was true, at least
according to the git documentation (and ^{} in that position has no
meaning to sed). Patch:

Strip no-longer-relevant trailing junk off the end of the tag transform.

diff --git a/cg-fetch b/cg-fetch
index 185467e..f514cbe 100755
--- a/cg-fetch
+++ b/cg-fetch
@@ -209,9 +209,9 @@ fetch_tags()
 	fi
 
 	git-ls-remote --tags "$uri" |
-		# SHA1 refs/tags/v0.99.8^{} --> SHA1 tags/v0.99.8
+		# 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' |
+		sed -ne 's:\([^	]\)	refs/\(tags/.*\)$:\1 \2:p' |
 		while read sha1 tagname; do
 			# Do we have the tag itself?
 			[ -s "$_git/refs/$tagname" ] && continue

-- 
`She *is*, however, one of the few sf authors with a last name ending in O,
 which adds some extra appeal to those of us who obsess about things like
 having a book review of an author for each letter in the alphabet.' -- rra



More information about the xorg mailing list