{"thread":{"id":"54142","subject":"Cleaning up files reported by size-garbage","startedAt":"2020-08-27T15:55:35Z","lastAt":"2020-08-27T17:36:51Z","messageCount":3,"participants":["Konstantin Ryabitsev","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"404622","messageId":"20200827155529.3vtmrec7nn3mqgpl@chatter.i7.local","threadId":"54142","inReplyTo":null,"subject":"Cleaning up files reported by size-garbage","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2020-08-27T15:55:29Z","receivedAt":"2020-08-27T15:55:35Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"Hello:\n\nRunning git count-objects -v reports garbage files:\n\n$ git count-objects -v\nwarning: garbage found: ./objects/pack/tmp_pack_XSv8MO\nwarning: garbage found: ./objects/pack/tmp_pack_2uOuMg\nwarning: garbage found: ./objects/pack/tmp_pack_KzP1ja\ncount: 19\nsize: 84\nin-pack: 172456\npacks: 6\nsize-pack: 63907\nprune-packable: 0\ngarbage: 3\nsize-garbage: 1911\n\nIs there a way to tell git to clean those up? I'm not finding anything \nand would rather avoid having to parse stderr in these cases.\n\nBest,\n-K\n"},{"id":"404630","messageId":"20200827171954.GA3970312@coredump.intra.peff.net","threadId":"54142","inReplyTo":"20200827155529.3vtmrec7nn3mqgpl@chatter.i7.local","subject":"Re: Cleaning up files reported by size-garbage","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-08-27T17:19:54Z","receivedAt":"2020-08-27T17:19:57Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 27, 2020 at 11:55:29AM -0400, Konstantin Ryabitsev wrote:\n\n> Running git count-objects -v reports garbage files:\n> \n> $ git count-objects -v\n> warning: garbage found: ./objects/pack/tmp_pack_XSv8MO\n> warning: garbage found: ./objects/pack/tmp_pack_2uOuMg\n> warning: garbage found: ./objects/pack/tmp_pack_KzP1ja\n> count: 19\n> size: 84\n> in-pack: 172456\n> packs: 6\n> size-pack: 63907\n> prune-packable: 0\n> garbage: 3\n> size-garbage: 1911\n> \n> Is there a way to tell git to clean those up? I'm not finding anything \n> and would rather avoid having to parse stderr in these cases.\n\nI think that git-gc will clean them up (via git-prune). It will also\ncheck that their mtimes are older than the expiration time, which avoids\naccidentally cleaning up the pack for an incoming fetch or push.\n\nThe default gc expiration time is 2 weeks, though, so you might want\nsomething like:\n\n  git gc --prune=5.minutes.ago\n\nif you're trying to get rid of them immediately. Likewise use git-prune\ndirectly if you don't want to incur the cost of a full gc/repack.\n\n-Peff\n"},{"id":"404632","messageId":"20200827173645.digsnbu3z4donzno@chatter.i7.local","threadId":"54142","inReplyTo":"20200827171954.GA3970312@coredump.intra.peff.net","subject":"Re: Cleaning up files reported by size-garbage","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2020-08-27T17:36:45Z","receivedAt":"2020-08-27T17:36:51Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"On Thu, Aug 27, 2020 at 01:19:54PM -0400, Jeff King wrote:\n> I think that git-gc will clean them up (via git-prune). It will also\n> check that their mtimes are older than the expiration time, which avoids\n> accidentally cleaning up the pack for an incoming fetch or push.\n> \n> The default gc expiration time is 2 weeks, though, so you might want\n> something like:\n> \n>   git gc --prune=5.minutes.ago\n> \n> if you're trying to get rid of them immediately. Likewise use git-prune\n> directly if you don't want to incur the cost of a full gc/repack.\n\nOh, you're totally right. For some reason I was convinced that git-prune \ndidn't touch them, but I stand corrected.\n\nThanks for the pointer!\n\n-K\n"}]}