{"thread":{"id":"2161","subject":"[PATCH] cg-fetch: handle tags with funny chars, retrieve missing commits","startedAt":"2005-10-20T05:07:46Z","lastAt":"2005-10-20T05:07:46Z","messageCount":1,"participants":["Martin Langhoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10340","messageId":"1129784866457-git-send-email-martin@catalyst.net.nz","threadId":"2161","inReplyTo":null,"subject":"[PATCH] cg-fetch: handle tags with funny chars, retrieve missing commits","fromName":"Martin Langhoff","fromEmail":"martin@catalyst.net.nz","sentAt":"2005-10-20T05:07:46Z","receivedAt":"2005-10-20T05:07:46Z","isPatch":true,"sender":{"key":"martin@laptop.org","avatar":null},"body":" + handles tags with funny chars a bit better\n + will check tagrefs, trying to ensure it actually has the relevant\n   commits. If the commits are missing, it'll go out and fetch them.\n + if the tagref points to a blob and we have it, it'll skip it\n\nThis isn't a complete solution for cg-fetch -- git-fetch is actually\nmuch smarter now, and cg-fetch should perhaps be a thin wrapper\naround it, dropping all the duplicate code.\n\nThis version uses ^0 instead of ^{commit} which does a more thorough check,\nso we don't need to call git-cat-file.\n\nSigned-off-by: Martin Langhoff <martin@catalyst.net.nz>\n\n\n---\n\n cg-fetch |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\napplies-to: 38ed7981343a8e2bb734d64e019186a8a482dbef\n6adda5a9a938adbc313c6ed40156257d62707757\ndiff --git a/cg-fetch b/cg-fetch\nindex 7694584..ec9fff3 100755\n--- a/cg-fetch\n+++ b/cg-fetch\n@@ -416,8 +416,9 @@ $get -i -s -u -d \"$uri/refs/tags\" \"$_git\n \tcd $_git/refs/tags\n \tfor tag in *; do\n \t\t[ \"$tag\" = \"*\" ] && break\n-\t\ttagid=$(cat $tag)\n-\t\tGIT_DIR=../.. git-cat-file -t \"$tagid\" >/dev/null 2>&1 && continue\n+\t\ttagid=$(cat \"$tag\")\n+\t\tGIT_DIR=../.. git-rev-parse --verify \"$tag\"^0 2>/dev/null >> /dev/null && continue\n+\t\tGIT_DIR=../.. git-cat-file blob `git-rev-parse --verify \"$tag\"^{blob} 2>/dev/null` 2>/dev/null >> /dev/null && continue\n \t\techo -n \"Missing object of tag $tag... \"\n \t\tif [ \"$fetch\" != \"fetch_rsync\" ] && GIT_DIR=../.. $fetch \"$tagid\" \"$uri\" 2>/dev/null >&2; then\n \t\t\techo \"retrieved\"\n---\n0.99.8.GIT\n"}]}