Re: [PATCH] cg-fetch will now retrieve commits related to tags if missing.

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] cg-fetch will now retrieve commits related to tags if missing.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:09

Martin Langhoff [off-list ref] writes:
quoted hunk
diff --git a/cg-fetch b/cg-fetch
index 7694584..d4650e5 100755
--- a/cg-fetch
+++ b/cg-fetch
@@ -417,7 +417,8 @@ $get -i -s -u -d "$uri/refs/tags" "$_git
 	for tag in *; do
 		[ "$tag" = "*" ] && break
 		tagid=$(cat $tag)
You just reported this $tag needs quoting ;-).
+		GIT_DIR=../.. [ "`git-cat-file -t $tagid 2>/dev/null`" = "commit" ] && continue
+		GIT_DIR=../.. git-cat-file commit `git-rev-parse $tag^{commit}  2>/dev/null` 2>&1 >> /dev/null && continue
You are saying:
	if "$tagid" is already commit then continue;
        if "$tagid" dereferences to a commit and if you have it
	then continue

If that is the case, then this might be more efficient.

	GIT_DIR=../.. git-rev-parse --verify "$tagid^0" >/dev/null 2>&1 && continue

You can say ^{commit} instead of ^0 if you like that newer
style, of course.

Re: [PATCH] cg-fetch will now retrieve commits related to tags if missing.

From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:09

On 10/20/05, Junio C Hamano [off-list ref] wrote:
You just reported this $tag needs quoting ;-).
I thought I had seen a post from you to Petr, mentioning that he had
just fixed it. I didn't see any fix when I updated, but I thought it
may have been due to mirroring issues. In any case, it obviously needs
quoting.
quoted
+             GIT_DIR=../.. [ "`git-cat-file -t $tagid 2>/dev/null`" = "commit" ] && continue
+             GIT_DIR=../.. git-cat-file commit `git-rev-parse $tag^{commit}  2>/dev/null` 2>&1 >> /dev/null && continue
You are saying:
        if "$tagid" is already commit then continue;
        if "$tagid" dereferences to a commit and if you have it
        then continue

If that is the case, then this might be more efficient.

        GIT_DIR=../.. git-rev-parse --verify "$tagid^0" >/dev/null 2>&1 && continue

You can say ^{commit} instead of ^0 if you like that newer
style, of course.
I tried, and failed to get it to work 100% so I reverted to the double
check you've seen. Must have been PEBKAC for now it works correctly --
possibly related to the unquoted tagnames.

Ok -- too many problems with that patch. Let's try it again...


martin

Re: [PATCH] cg-fetch will now retrieve commits related to tags if missing.

From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:09

On 10/20/05, Junio C Hamano [off-list ref] wrote:
You are saying:
        if "$tagid" is already commit then continue;
        if "$tagid" dereferences to a commit and if you have it
        then continue

If that is the case, then this might be more efficient.

        GIT_DIR=../.. git-rev-parse --verify "$tagid^0" >/dev/null 2>&1 && continue
Note however that git-rev-parse is lazy and won't check that the
commit is there. I have to call git-cat-file and check whether it
succeeds to know if we have the object.

cheers,


martin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help