Re: cg-clone, tag objects and cg-push/git-push don't play nice
- From
Martin Langhoff <martin.langhoff@gmail.com>
- Date
- Oct 19, 2005, 08:10 UTC
- Message-ID
- <46a038f90510190110g53c90c5t419ad6065292269e@mail.gmail.com>
- In-Reply-To
- <7vzmp6dlii.fsf@assigned-by-dhcp.cox.net>
On 10/19/05, Junio C Hamano <junkio@cox.net> wrote:
Show 7 quoted lines
> Martin Langhoff <martin.langhoff@gmail.com> writes: > > > + git-push is trying to walk all the refs it knows about when it does > > the "what do I have that the repo doesn't" part, and it breaks on > > those incomplete tag fetches. > > That is expected.
Hmmm. I was under the impression that if I call git-push naming a particular head, it could restrict itself to the stuff needed for that head only. Just to clarify, I'm running
git-push locke.catalyst.net.nz:/var/git/moodle-test.git master:mdl-topnz-prod
> Although I do not follow Cogito development closely, I seem to > recall that it fetched tags without making them complete at some > point in the past; I hope it is now fixed but I am not sure.
It isn't fixed, but I'm trying to address that one :-p
> I do not understand why removing .git/refs/tags/* did not help, > and that is the biggest thing that disturbs me in this whole > problem report
I can't understand that either, but I manually removed all the refs/tags, and the only heads I have are origin and master. git-push won't let me do it until the exact point where I have removed the object from the repo. And that's only possible on unpacked repos.
> Maybe there are some other files > under .git/refs/ directory that had copies of them?
No. I run a test again, to make sure. Removing .git/refs/tags is not enough, and the only refs available are origin and master.
I've come up with this awful script to resolve it, while I try to fix cg-fetch:
#usr/bin/perl -w
use strict;
my @refs = `ls .git/refs/tags`;
foreach my $ref (@refs) {
chomp $ref;
print "testing for a commit linked from $ref\n";
my $commit = `git-rev-parse --verify "$ref"^{commit} 2>/dev/null`;
if ($?) {
# this one didn't even have a tag ref pointing to a commit!
#unlink ".git/refs/tags/$ref"
# or die "cannot remove .git/refs/tags/$ref";
#next;
} # thest that we actually have the commit object...
chomp $commit;
my $file = `git-cat-file commit $commit 2>/dev/null`;
if ($?) {
# could not find the commit object, we better get rid of the
# tagref and tagobj
my $tagsha = `git-rev-parse --verify "$ref" 2>/dev/null`; chomp $tagsha;
if ($tagsha) {
# doublecheck it is a tag
my $type = `git-cat-file -t $tagsha 2>/dev/null`;
chomp $type;
if ($type eq 'tag') {
my $fileobj = ".git/objects/" . substr($tagsha,0,2) . '/' .
substr($tagsha,2);
print " removing $fileobj for ref $ref tagsha $tagsha \n";
`rm -f $fileobj`;
unlink ".git/refs/tags/$ref";
}
}
}
}cheers,
m