{"thread":{"id":"36076","subject":"Testing for commit reachability through plumbing commands","startedAt":"2014-03-06T17:17:34Z","lastAt":"2014-03-06T20:23:19Z","messageCount":4,"participants":["Martin Langhoff","Andreas Schwab","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"236170","messageId":"CACPiFCJLyE6XC9dY_eawe2y9gS4YsPdTbqkKAd0dcPXd5-eMCg@mail.gmail.com","threadId":"36076","inReplyTo":null,"subject":"Testing for commit reachability through plumbing commands","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2014-03-06T17:17:34Z","receivedAt":"2014-03-06T17:17:34Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"I have a shell script that trims old history on a cronjob. This is for\na repo that is used to track reports that have limited \"life\" (like\nlogs). Old history is trimmed with grafts pointing to an empty \"root\"\ncommit.\n\nRight now, info/graft grows unbound. I am looking for a way to trim\nunreachable grafts, I would like to be able to say something like:\n\n git is-reachable treeish\n\nGrepping through docs and existing code hasn't helped, but perhaps I'm\nmissing something obvious...\n\nThis repository has a couple hundred branches (one per server\ntracked). For a single branch, I can picture a relatively easy\napproach with git merge-base.\n\nthanks!\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n -  ask interesting questions\n - don't get distracted with shiny stuff  - working code first\n ~ http://docs.moodle.org/en/User:Martin_Langhoff\n"},{"id":"236182","messageId":"877g879lwp.fsf@igel.home","threadId":"36076","inReplyTo":"CACPiFCJLyE6XC9dY_eawe2y9gS4YsPdTbqkKAd0dcPXd5-eMCg@mail.gmail.com","subject":"Re: Testing for commit reachability through plumbing commands","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2014-03-06T19:17:42Z","receivedAt":"2014-03-06T19:17:42Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Martin Langhoff <martin.langhoff@gmail.com> writes:\n\n> I have a shell script that trims old history on a cronjob. This is for\n> a repo that is used to track reports that have limited \"life\" (like\n> logs). Old history is trimmed with grafts pointing to an empty \"root\"\n> commit.\n>\n> Right now, info/graft grows unbound. I am looking for a way to trim\n> unreachable grafts, I would like to be able to say something like:\n>\n>  git is-reachable treeish\n>\n> Grepping through docs and existing code hasn't helped, but perhaps I'm\n> missing something obvious...\n\nDoes git fsck --unreachable --no-reflogs help?\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"236184","messageId":"CACPiFC+hajx+z_Yq8vC88Q2DsSyD6zg0uOcjMmo7Qhj2m7r4Fg@mail.gmail.com","threadId":"36076","inReplyTo":"877g879lwp.fsf@igel.home","subject":"Re: Testing for commit reachability through plumbing commands","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2014-03-06T19:29:34Z","receivedAt":"2014-03-06T19:29:34Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On Thu, Mar 6, 2014 at 2:17 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Does git fsck --unreachable --no-reflogs help?\n\nWell, my script, called regularly, does:\n\n - adds grafts\n - git repack -AFfd (which unpacks unreachable objects)\n - git prune --expire now\n\n.... hmm, I guess could prune the grafts using git fsck --unreachable\n--no-reflogs before pruning the objects themselves.\n\nwe'll find out if it works :-)\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n -  ask interesting questions\n - don't get distracted with shiny stuff  - working code first\n ~ http://docs.moodle.org/en/User:Martin_Langhoff\n"},{"id":"236194","messageId":"20140306202319.GB29659@sigill.intra.peff.net","threadId":"36076","inReplyTo":"CACPiFCJLyE6XC9dY_eawe2y9gS4YsPdTbqkKAd0dcPXd5-eMCg@mail.gmail.com","subject":"Re: Testing for commit reachability through plumbing commands","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-06T20:23:19Z","receivedAt":"2014-03-06T20:23:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 06, 2014 at 12:17:34PM -0500, Martin Langhoff wrote:\n\n> I have a shell script that trims old history on a cronjob. This is for\n> a repo that is used to track reports that have limited \"life\" (like\n> logs). Old history is trimmed with grafts pointing to an empty \"root\"\n> commit.\n> \n> Right now, info/graft grows unbound. I am looking for a way to trim\n> unreachable grafts, I would like to be able to say something like:\n> \n>  git is-reachable treeish\n\nHow about:\n\n    git rev-list --objects --all |\n    cut -d' ' -f1 |\n    grep $(git rev-parse treeish)\n\nAdd \"--reflog\" to the rev-list invocation if you want to catch things\nreferenced by the reflog, too.\n\nIf you're looking for a commit, you can drop the \"--objects\", and it\nwill run much faster.\n\n-Peff\n"}]}