Git development
 help / color / mirror / Atom feed
From: Petr 'Patch Proxy' Baudis <pasky@ucw.cz>
To: git@vger.kernel.org
Subject: [PATCH] git-fetch.sh: fix fetching of tags that point directly to commits
Date: Sun, 19 Nov 2006 03:59:21 +0100	[thread overview]
Message-ID: <20061119025921.GU7201@pasky.or.cz> (raw)

git-fetch used to fetch only tags that pointed to tag objects,
because it required a ^{} suffix from git-ls-remote's output.

Not signed off.
---

For similar issue in Cogito, please see

	http://news.gmane.org/find-root.php?message_id=<20060427105251.AA4B2353DAC@atlas.denx.de>

Curiously enough, Junio himself posted a patch. Perhaps given his state
as of then he forgot to fix Git as well. ;-)

I did not write this patch. One fellow IRCer did, but for personal
reasons he does not wish to disclose his realname. I think the patch is
trivial enough that copyright problems should not be a issue.

 git-fetch.sh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-fetch.sh b/git-fetch.sh
index 7442dd2..9074b3f 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -430,9 +430,13 @@ case "$no_tags$tags" in
 	*:refs/*)
 		# effective only when we are following remote branch
 		# using local tracking branch.
-		taglist=$(IFS=" " &&
+		# If we get both refs/tags/foo and refs/tags/foo^{},
+		# use only the latter and strip the ^{} suffix.
+		taglist=$(
+		IFS=" "; export LC_COLLATE=C
 		git-ls-remote $upload_pack --tags "$remote" |
-		sed -ne 's|^\([0-9a-f]*\)[ 	]\(refs/tags/.*\)^{}$|\1 \2|p' |
+		sed -ne 's|^\([0-9a-f]*\)[ \t]\(refs/tags/.*\)$|\1 \2|p' |
+		sort -k2 -r | sed -e 's/\^{}$//' | uniq -f1 |
 		while read sha1 name
 		do
 			git-show-ref --verify --quiet -- $name && continue

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
The meaning of Stonehenge in Traflamadorian, when viewed from above, is:
"Replacement part being rushed with all possible speed."

                 reply	other threads:[~2006-11-19  2:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061119025921.GU7201@pasky.or.cz \
    --to=pasky@ucw.cz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox