* [PATCH] cg-fetch: retrieve missing commits with a smarter optimization
@ 2005-10-21 5:31 Martin Langhoff
2005-10-21 12:47 ` Petr Baudis
0 siblings, 1 reply; 2+ messages in thread
From: Martin Langhoff @ 2005-10-21 5:31 UTC (permalink / raw)
To: git; +Cc: Martin Langhoff
I've actually rebased this one so Petr doesn't have to deal
with the silly conflicts. It also turns out that my repo got
fsck'd in one of the last updates, and cg-merge was seriously
broken. I guess did an update in the middle of the transition
between positional parameters and named parameters, and got stuck.
Actual commit message follows.
---
+ will check tagrefs, trying to ensure it actually has the relevant
commits. If the commits are missing, it'll go out and fetch them.
+ if the tagref points to a blob and we have it, it'll skip it
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.
This version uses ^0 instead of ^{commit} which does a more thorough check,
so we don't need to call git-cat-file.
---
cg-fetch | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
applies-to: e6fab694ece986de77f6e17c16df9f17276c6666
e2cf1ab9b594d3d12655dd93377dfea03247379e
diff --git a/cg-fetch b/cg-fetch
index b004ab3..f0c11aa 100755
--- a/cg-fetch
+++ b/cg-fetch
@@ -377,7 +377,8 @@ $get -i -s -u -d "$uri/refs/tags" "$_git
for tag in *; do
[ "$tag" = "*" ] && break
tagid="$(cat "$tag")"
- GIT_DIR=../.. git-cat-file -t "$tagid" >/dev/null 2>&1 && continue
+ GIT_DIR=../.. git-rev-parse --verify "$tag"^0 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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] cg-fetch: retrieve missing commits with a smarter optimization
2005-10-21 5:31 [PATCH] cg-fetch: retrieve missing commits with a smarter optimization Martin Langhoff
@ 2005-10-21 12:47 ` Petr Baudis
0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2005-10-21 12:47 UTC (permalink / raw)
To: Martin Langhoff; +Cc: git
Could you please resend your patches signed off? Thanks.
Dear diary, on Fri, Oct 21, 2005 at 07:31:31AM CEST, I got a letter
where Martin Langhoff <martin@catalyst.net.nz> told me that...
> + will check tagrefs, trying to ensure it actually has the relevant
> commits. If the commits are missing, it'll go out and fetch them.
I'd prefer the approach to throw away the tag. Otherwise we get into
problems when we want to grab only a single branch from multi-branch
repository.
> + if the tagref points to a blob and we have it, it'll skip it
The problem is that the ^{blob} syntax is not in 0.98, so this would
make Cogito depend on a yet unreleased GIT version, which is
troublesome.
So I guess this patch will end up in my post-0.99/1.0 queue for now.
But by that time, this part of cg-fetch will be probably already totally
rewritten. ;-)
> 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.
I'm still thinking about it. I will certainly try to at least somehow
reuse git-fetch's remote parser, if not anything else - reimplementing
that would be just stupid.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-21 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-21 5:31 [PATCH] cg-fetch: retrieve missing commits with a smarter optimization Martin Langhoff
2005-10-21 12:47 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox