{"thread":{"id":"2212","subject":"[PATCH] cg-fetch: handle tags with funny chars, retrieve missing commits","startedAt":"2005-10-24T20:49:23Z","lastAt":"2005-10-24T20:49:23Z","messageCount":1,"participants":["Martin Langhoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10551","messageId":"1130186963916-git-send-email-martin@catalyst.net.nz","threadId":"2212","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-24T20:49:23Z","receivedAt":"2005-10-24T20:49:23Z","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\nResend: added signoff as requested.\n\n---\n\n cg-fetch |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\napplies-to: e6fab694ece986de77f6e17c16df9f17276c6666\ne2cf1ab9b594d3d12655dd93377dfea03247379e\ndiff --git a/cg-fetch b/cg-fetch\nindex b004ab3..f0c11aa 100755\n--- a/cg-fetch\n+++ b/cg-fetch\n@@ -377,7 +377,8 @@ $get -i -s -u -d \"$uri/refs/tags\" \"$_git\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\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"}]}