Skip to contentSkip to conversation

cg-fetch: handle tags with funny chars, retrieve missing commits

PATCH In review Martin Langhoff 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cg-fetch: handle tags with funny chars, retrieve missing commits

+ handles tags with funny chars a bit better
+ will check tagrefs, trying to ensure it actually has the relevant commits. If the commits are missing, it'll go out and fetch them.

This isn't a complete solution for cg-fetch -- git-fetch is actually much smarter now, and cg-fetch should perhaps be a thin wrapper around it, dropping all the duplicate code.

---

 cg-fetch |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

applies-to: 38ed7981343a8e2bb734d64e019186a8a482dbef 21a91d74a6807677f8e59c737fee3692d0f392e8

cg-fetch +3 -2
index 7694584..625444c 100755
@@ -416,8 +416,9 @@ $get -i -s -u -d "$uri/refs/tags" "$_git
 	cd $_git/refs/tags
 	for tag in *; do
 		[ "$tag" = "*" ] && break
-		tagid=$(cat $tag)
-		GIT_DIR=../.. git-cat-file -t "$tagid" >/dev/null 2>&1 && continue
+		tagid=$(cat "$tag")
+		GIT_DIR=../.. git-cat-file commit `git-rev-parse --verify "$tag"^{commit} 2>/dev/null` 2>/dev/null >> /dev/null && continue
+		GIT_DIR=../.. git-cat-file blob `git-rev-parse --verify "$tag"^{blob} 2>/dev/null` 2>/dev/null >> /dev/null && continue
 		echo -n "Missing object of tag $tag... "
 		if [ "$fetch" != "fetch_rsync" ] && GIT_DIR=../.. $fetch "$tagid" "$uri" 2>/dev/null >&2; then
 			echo "retrieved"

---
0.99.8.GIT

#1 lore raw

Pulled, superceded by new version.

Quoted 9 lines · Martin Langhoff

+ handles tags with funny chars a bit better
+ will check tagrefs, trying to ensure it actually has the relevant commits. If the commits are missing, it'll go out and fetch them.

This isn't a complete solution for cg-fetch -- git-fetch is actually much smarter now, and cg-fetch should perhaps be a thin wrapper around it, dropping all the duplicate code.