{"thread":{"id":"1005","subject":"git-prune-script eats data","startedAt":"2005-06-22T00:51:53Z","lastAt":"2005-06-23T05:25:01Z","messageCount":3,"participants":["Jeff Garzik","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"5112","messageId":"42B8B629.1040208@pobox.com","threadId":"1005","inReplyTo":null,"subject":"git-prune-script eats data","fromName":"Jeff Garzik","fromEmail":"jgarzik@pobox.com","sentAt":"2005-06-22T00:51:53Z","receivedAt":"2005-06-22T00:51:53Z","isPatch":false,"sender":{"key":"jgarzik@pobox.com","avatar":null},"body":"\nOk, I have a reproducible case (at least for me), of git-prune-script \nmunching data. I'll just give reproduction instructions (everyone \nreading this can do what I did), and some output at the end.\n\n$ cd /repos\n\n$ mkdir libata-dev-test/.git\n\n$ cd libata-dev-test\n\n$ cp -al ../linux-2.6/.git/objects .git/\n\n$ rsync -az --verbose --delete \\\nrsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git/ \n  .git/\t\t# word-wrapped from previous line\n\n$ git-checkout-script -f\n\n$ git-fsck-cache\ndangling commit 1b142a71f3b131317489edf806abfab4c347476c\ndangling commit 51a7f407d9b600e3278449a12135a21ffb0791a2\ndangling commit eb93f3e7284204379444137a660b64f9dbd2ec04\ndangling commit fcf604172829176bc618663e8387c8943ff88b66\n\nNOTE:  These dangling commits are NORMAL -- stuff that really does need \npruning.\n\n$ git-prune-script\n\n$ git-fsck-cache\nerror: cannot map sha1 file c39ae07f393806ccf406ef966e9a15afc43cc36a\nbad object in tag 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c\nbad sha1 entry '5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c'\n\n$ rsync -az --verbose --delete \\\nrsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git/ \n  .git/\t\t# word-wrapped from previous line\n\t\t# this second invocation downloads a TON of objects,\n\t\t# most/all of which are in the vanilla linux-2.6 tree\n\t\t# and should not have been pruned\n\n\n"},{"id":"5149","messageId":"Pine.LNX.4.58.0506221857410.11175@ppc970.osdl.org","threadId":"1005","inReplyTo":"42B8B629.1040208@pobox.com","subject":"Re: git-prune-script eats data","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-23T02:04:46Z","receivedAt":"2005-06-23T02:04:46Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 21 Jun 2005, Jeff Garzik wrote:\n> \n> $ git-prune-script\n> \n> $ git-fsck-cache\n> error: cannot map sha1 file c39ae07f393806ccf406ef966e9a15afc43cc36a\n> bad object in tag 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c\n> bad sha1 entry '5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c'\n\nIt's exactly the same thing that Jens had. You have a tag object for the \nv2.6.11-tree thing, but you don't have the reference to the tag.\n\nAnd now I realize what the problem is. It's _not_ that \"git prune\" has \nremoved too much, like the obvious implication would be: it's that \"git \nprune\" has not removed _enough_.\n\n\"git prune\" normally never removes tag-objects, whether reachable or not. \nThat's because git-fsck-cache was explicitly ignoring them, which was \nbecause early on, the way you found tags was you did\n\n\tgit-fsck-cache --tags\n\nand then you created refs to them manually. \n\nBut now that special case causes problems (and is no longer needed \nanyway), because it means that \"git prune\" will not remove unreachable \ntags, but it _will_ remove everything that an unreachable tag points to \n(because that is also unreachable).\n\nSo the trivial fix is to just remove the lines from fsck-cache.c that say\n\n\t/* Don't bother with tag reachability. */\n\tif (obj->type == tag_type)\n\t\tcontinue;\n\nand that will fix it for you.\n\nWill do.\n\n\t\tLinus\n"},{"id":"5162","messageId":"42BA47AD.3000508@pobox.com","threadId":"1005","inReplyTo":"Pine.LNX.4.58.0506221857410.11175@ppc970.osdl.org","subject":"Re: git-prune-script eats data","fromName":"Jeff Garzik","fromEmail":"jgarzik@pobox.com","sentAt":"2005-06-23T05:25:01Z","receivedAt":"2005-06-23T05:25:01Z","isPatch":false,"sender":{"key":"jgarzik@pobox.com","avatar":null},"body":"Linus Torvalds wrote:\n> And now I realize what the problem is. It's _not_ that \"git prune\" has \n> removed too much, like the obvious implication would be: it's that \"git \n> prune\" has not removed _enough_.\n\nMakes a lot of sense.  Looking at the repo, I did indeed forget to copy \nthe tags.\n\n\n> So the trivial fix is to just remove the lines from fsck-cache.c that say\n> \n> \t/* Don't bother with tag reachability. */\n> \tif (obj->type == tag_type)\n> \t\tcontinue;\n> \n> and that will fix it for you.\n\nSounds good, thanks.\n\n\n> It's exactly the same thing that Jens had. You have a tag object for the \n> v2.6.11-tree thing, but you don't have the reference to the tag.\n\nRef email just sent:  Kernel hackers expect tags to come with the pull. \n  Four kernel hackers, and counting.\n\nJust accept that our brains are wired that way ;-)  We like having \nLinus-blessed-and-pushed-to-kernel.org tags from linux-2.6.git public \ntree follow us around.\n\n\tgit-pull-script --tags $url\n\nshould accomplish that.\n\n\tJeff\n\n\n"}]}