{"thread":{"id":"8781","subject":"Question about git-prune","startedAt":"2007-06-30T16:29:04Z","lastAt":"2007-06-30T20:18:01Z","messageCount":5,"participants":["walt","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"46095","messageId":"Pine.LNX.4.64.0706300915440.16800@x2.ybpnyarg","threadId":"8781","inReplyTo":null,"subject":"Question about git-prune","fromName":"walt","fromEmail":"wa1ter@myrealbox.com","sentAt":"2007-06-30T16:29:04Z","receivedAt":"2007-06-30T16:29:04Z","isPatch":false,"sender":{"key":"wa1ter@myrealbox.com","avatar":null},"body":"I'm wondering why git-prune seems to work differently on the two git\nrepositories I track (Junio's and Linus's).\n\nSpecifically, when I use git-prune on Linus's kernel, all the dangling\nobjects disappear completely, and git-fsck shows no objects remaining.\n\nBut this is what happens with Junio's repository:\n\n$cd src/git\n$git-fsck\ndangling tree c642c018aa55d39fff061183f58062de9d8375ac\ndangling commit e1341abc3759950e891822088cb0163b71b316b3\ndangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\ndangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n$git-prune\n$git-fsck\ndangling tree c642c018aa55d39fff061183f58062de9d8375ac\ndangling commit e1341abc3759950e891822088cb0163b71b316b3\ndangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\ndangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n\nAnd here is another puzzle:\n\n$git-fsck --unreachable\nunreachable commit f291504563a5c96862e600247d233f91572a005f\nunreachable tree 0e925e128b7b83750e2b8b0d901d7d518cadbdaf\nunreachable tree c642c018aa55d39fff061183f58062de9d8375ac\nunreachable tree 0b43ac348827a25d54a6fc90c36c12c4c6bdd6c1\nunreachable tree 4d43b9900856904cdfc69769124b1930435dae51\nunreachable commit e1341abc3759950e891822088cb0163b71b316b3\nunreachable blob 590533321a99bf4d00b872a839527f00616ed593\nunreachable tree e355b3845361c5f0c829bd146c47c77867aa36a3\nunreachable tree 7e08ac7c56e51ea94db1dd6525c26fe123537b07\nunreachable commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\nunreachable commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\nunreachable commit 750f7b668f33c9e8decbdd8141115328992d6fea\n\ngit-prune is supposed to remove all the unreachable objects, IIUC,\nso it seems that git-prune does nothing at all in Junio's repo.\n\nCan anyone reproduce this behavior, or explain it?\n\nThanks.\n"},{"id":"46108","messageId":"Pine.LNX.4.64.0706301900290.4438@racer.site","threadId":"8781","inReplyTo":"Pine.LNX.4.64.0706300915440.16800@x2.ybpnyarg","subject":"Re: Question about git-prune","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-30T18:02:16Z","receivedAt":"2007-06-30T18:02:16Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 30 Jun 2007, walt wrote:\n\n> $cd src/git\n> $git-fsck\n> dangling tree c642c018aa55d39fff061183f58062de9d8375ac\n> dangling commit e1341abc3759950e891822088cb0163b71b316b3\n> dangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\n> dangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n> $git-prune\n> $git-fsck\n> dangling tree c642c018aa55d39fff061183f58062de9d8375ac\n> dangling commit e1341abc3759950e891822088cb0163b71b316b3\n> dangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\n> dangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n\nProbably the objects were packed.\n\nI do not understand why you use git-prune directly, to begin with. Why not \nuse git-gc and be done with it?\n\nHth,\nDscho\n"},{"id":"46122","messageId":"f66d3l$sa6$1@sea.gmane.org","threadId":"8781","inReplyTo":"Pine.LNX.4.64.0706301900290.4438@racer.site","subject":"Re: Question about git-prune","fromName":"walt","fromEmail":"wa1ter@myrealbox.com","sentAt":"2007-06-30T20:06:09Z","receivedAt":"2007-06-30T20:06:09Z","isPatch":false,"sender":{"key":"wa1ter@myrealbox.com","avatar":null},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Sat, 30 Jun 2007, walt wrote:\n...\n>> $git-prune\n>> $git-fsck\n>> dangling tree c642c018aa55d39fff061183f58062de9d8375ac\n>> dangling commit e1341abc3759950e891822088cb0163b71b316b3\n>> dangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\n>> dangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n> \n> Probably the objects were packed.\n\nI also tried git-prune-packed, which also did nothing AFAICT.\n\n> I do not understand why you use git-prune directly, to begin with. Why not \n> use git-gc and be done with it?\n\nIt didn't exist when I started using git.  I normally don't use \ngit-prune either, but in this case I was just scanning for problems\nafter switching from cg-update to git-pull.\n\ngit-gc did get rid of all the danglers even though git-prune didn't.\nI'll do some investigating to find out why -- that should get me more\nup to date with recent changes.\n\nThanks for your help.\n"},{"id":"46124","messageId":"7vps3db3rc.fsf@assigned-by-dhcp.cox.net","threadId":"8781","inReplyTo":"f66d3l$sa6$1@sea.gmane.org","subject":"Re: Question about git-prune","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T20:12:39Z","receivedAt":"2007-06-30T20:12:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"walt <wa1ter@myrealbox.com> writes:\n\n>> Probably the objects were packed.\n>\n> I also tried git-prune-packed, which also did nothing AFAICT.\n\nOf course it wouldn't; prune-packed is to prune loose objects\nthat also appear in packs.\n\nWhat is happening is:\n\n - You create a pack that has everything reachable from refs at\n   one point;\n\n - You pull or do your own development; the set of objects\n   reachable from refs change from the above set.  This set is\n   superset of the above only if there is no rewind is\n   involved.  Otherwise, some objects already packed in the\n   previous step are now unreachable.\n\n - git-prune and git-prune-packed are about removing loose\n   objects.  They never go into existing packs and eradicate\n   objects from them.\n\nWhen you have unreachable cruft in packs, repacking is the only\nway to rid them (\"git repack -a -d\", which is run by \"git gc\").\n"},{"id":"46125","messageId":"Pine.LNX.4.64.0706302115290.4438@racer.site","threadId":"8781","inReplyTo":"f66d3l$sa6$1@sea.gmane.org","subject":"Re: Question about git-prune","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-30T20:18:01Z","receivedAt":"2007-06-30T20:18:01Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 30 Jun 2007, walt wrote:\n\n> Johannes Schindelin wrote:\n> > \n> > On Sat, 30 Jun 2007, walt wrote:\n> ...\n> > > $git-prune\n> > > $git-fsck\n> > > dangling tree c642c018aa55d39fff061183f58062de9d8375ac\n> > > dangling commit e1341abc3759950e891822088cb0163b71b316b3\n> > > dangling commit 9f38e1ef7e7992ca490b9b419f52fb4d11efb0e4\n> > > dangling commit b82871b3c32faa8a317007f343fdf2d0ddc9954e\n> > \n> > Probably the objects were packed.\n> \n> I also tried git-prune-packed, which also did nothing AFAICT.\n\ngit-prune-packed prunes objects which are loose _and_ packed.\n\n> > I do not understand why you use git-prune directly, to begin with. Why \n> > not use git-gc and be done with it?\n> \n> It didn't exist when I started using git.  I normally don't use \n> git-prune either, but in this case I was just scanning for problems \n> after switching from cg-update to git-pull.\n\nFair enough.\n\n> git-gc did get rid of all the danglers even though git-prune didn't. \n> I'll do some investigating to find out why -- that should get me more up \n> to date with recent changes.\n\nThe thing you needed was actually git-repack (which is called with every \nnecessary option you need from git-gc).\n\nBasically, your objects were dangling _and_ packed. Thus you had to repack \nin order to get rid of them, but keep the others.\n\nCiao,\nDscho\n"}]}