{"thread":{"id":"3589","subject":"git-unpack-objects < pack file in repository doesn't work!","startedAt":"2006-03-07T01:13:02Z","lastAt":"2006-03-09T10:14:20Z","messageCount":5,"participants":["Blaisorblade","Shawn Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"17273","messageId":"200603070213.02805.blaisorblade@yahoo.it","threadId":"3589","inReplyTo":null,"subject":"git-unpack-objects < pack file in repository doesn't work!","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2006-03-07T01:13:02Z","receivedAt":"2006-03-07T01:13:02Z","isPatch":false,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"It's not a bug, it's an undocumented feature. It should be documented as \n\"git-unpack-objects < $pack; rm $pack\" is something one would deem correct at \nfirst glance (luckily I just moved the pack away and did git-fsck-cache).\n\nTo write an object, git-unpack-objects ends in\n\nunpack-objects.c:write_object -> sha1_file.c:write_sha1_file:\n\n        /* Normally if we have it in the pack then we do not bother writing\n         * it out into .git/objects/??/?{38} file.\n         */\n\nThis indeed works, so the files aren't unpacked.\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"},{"id":"17274","messageId":"20060307022926.GB29180@spearce.org","threadId":"3589","inReplyTo":"200603070213.02805.blaisorblade@yahoo.it","subject":"Re: git-unpack-objects < pack file in repository doesn't work!","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-03-07T02:29:26Z","receivedAt":"2006-03-07T02:29:26Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Blaisorblade <blaisorblade@yahoo.it> wrote:\n> It's not a bug, it's an undocumented feature. It should be documented as \n> \"git-unpack-objects < $pack; rm $pack\" is something one would deem correct at \n> first glance (luckily I just moved the pack away and did git-fsck-cache).\n> \n> To write an object, git-unpack-objects ends in\n> \n> unpack-objects.c:write_object -> sha1_file.c:write_sha1_file:\n> \n>         /* Normally if we have it in the pack then we do not bother writing\n>          * it out into .git/objects/??/?{38} file.\n>          */\n> \n> This indeed works, so the files aren't unpacked.\n\nFunny, I just did the exact same thing today, scratched my head and\nsaid ``what did I just do!?!?!'' as I had deleted the pack before\ndiscovering that nothing was actually unpacked.  *sigh* At least\nit was a clone of the real repository and thus didn't matter to me.\n\nI totally didn't expect that behavior.  But I should have.  It makes\nperfect sense.\n\n-- \nShawn.\n"},{"id":"17276","messageId":"7vlkvn54sv.fsf@assigned-by-dhcp.cox.net","threadId":"3589","inReplyTo":"20060307022926.GB29180@spearce.org","subject":"Re: git-unpack-objects < pack file in repository doesn't work!","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-07T03:09:36Z","receivedAt":"2006-03-07T03:09:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Pearce <spearce@spearce.org> writes:\n\n> I totally didn't expect that behavior.  But I should have.  It makes\n> perfect sense.\n\nGood to hear that you two did not lose any data.  I think the\ncommand should be documented as \"not for interactive use without\nunderstanding what it does\" ;-).\n\nWhat was the reason you wanted to use it?  I think we should\nhave a wrapper command to do what you wanted to achieve, so that\npeople do not have to run unpack-objects by hand.\n\nOne thing I _could_ think of is to explode a contaminated pack\nso that you can repack.  For example, every time I do \"git\nrepack -a -d\", the resulting pack ends up containing a couple of\ncommits from my \"pu\" branch that will become dangling when I\nredo \"pu\" the next time.  But then \"git repack -a -d\" is so\ninexpensive these days, without unpacking things first, I do not\nsee the point of exploding a pack using unpack-objects in the\nfirst place.\n"},{"id":"17279","messageId":"20060307040255.GA29544@spearce.org","threadId":"3589","inReplyTo":"7vlkvn54sv.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-unpack-objects < pack file in repository doesn't work!","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-03-07T04:02:55Z","receivedAt":"2006-03-07T04:02:55Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Shawn Pearce <spearce@spearce.org> writes:\n> \n> > I totally didn't expect that behavior.  But I should have.  It makes\n> > perfect sense.\n> \n> Good to hear that you two did not lose any data.  I think the\n> command should be documented as \"not for interactive use without\n> understanding what it does\" ;-).\n> \n> What was the reason you wanted to use it?  I think we should\n> have a wrapper command to do what you wanted to achieve, so that\n> people do not have to run unpack-objects by hand.\n\nDon't bother.\n\nI wanted to explode a pack because I'm starting work on an Eclipse\nplugin for GIT.  I thought I'd try going down the road of letting\nthe plugin read the repository directly, and write loose objects\ndirectly, but leave pack construction to the native C code.  So I\ntried to clone my local GIT repository to a new directory (thus\nhad no loose objects at all) and unpack it to get loose objects.\nThat didn't go so well.  :-)\n\nSo now I'm currently just playing around with a tiny repository I\ncreated for testing (something like 50 objects total).  Since I have\nnever packed it everything is loose, and that's working out OK...\n\nI've already got loose object reading working, but thanks to\nthe trivially simple repository format in GIT (thanks Linus,\net.al.!) that amounted to a trivial Java implementation so its\nnothing to really brag about yet.  :-)\n\n-- \nShawn.\n"},{"id":"17361","messageId":"7v4q287wn7.fsf@assigned-by-dhcp.cox.net","threadId":"3589","inReplyTo":"20060307040255.GA29544@spearce.org","subject":"Re: git-unpack-objects < pack file in repository doesn't work!","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-09T10:14:20Z","receivedAt":"2006-03-09T10:14:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Pearce <spearce@spearce.org> writes:\n\n> I wanted to explode a pack because I'm starting work on an Eclipse\n> plugin for GIT.  I thought I'd try going down the road of letting\n> the plugin read the repository directly, and write loose objects\n> directly, but leave pack construction to the native C code.  So I\n> tried to clone my local GIT repository to a new directory (thus\n> had no loose objects at all) and unpack it to get loose objects.\n> That didn't go so well.  :-)\n\nBefore \"git-repack -a\" was invented, I used to do this by hand:\n\n\t$ mkdir ./++preserve\n        $ mv .git/objects/pack/pack-*.pack ./++preserve\n        $ for p in ./++preserve/pack-*.pack\n          do git-unpack-objects <$p; done\n"}]}