{"thread":{"id":"46586","subject":"Add --ignore-missing to git-pack-objects?","startedAt":"2017-08-14T22:51:25Z","lastAt":"2017-08-20T16:05:33Z","messageCount":3,"participants":["ch","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"326337","messageId":"7d7a5801-1418-cc03-6d88-c148a38fccec@onlinehome.de","threadId":"46586","inReplyTo":null,"subject":"Add --ignore-missing to git-pack-objects?","fromName":"ch","fromEmail":"cr@onlinehome.de","sentAt":"2017-08-14T22:51:01Z","receivedAt":"2017-08-14T22:51:25Z","isPatch":false,"sender":{"key":"cr@onlinehome.de","avatar":null},"body":"Hi.\n\nIs it possible to add an option akin to git-rev-list's '--ignore-missing' to\ngit-pack-objects?\n\nI use git bundles to (incrementally) backup my repositories. My script inspects\nall bundles in the backup and passes their contained refs as excludes to\ngit-pack-objects to build the pack for the new bundle. This works fine as long\nas none of these refs have been garbage-collected in the source repository.\nSomething like '--ignore-missing' would be really handy here to ask\ngit-pack-objects to simply ignore any of the passed revs that are not present\n(anymore).\n\nThanks in advance.\n"},{"id":"326812","messageId":"20170820101632.irj22dighcrrcvlv@sigill.intra.peff.net","threadId":"46586","inReplyTo":"7d7a5801-1418-cc03-6d88-c148a38fccec@onlinehome.de","subject":"Re: Add --ignore-missing to git-pack-objects?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-08-20T10:16:32Z","receivedAt":"2017-08-20T10:16:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Aug 15, 2017 at 12:51:01AM +0200, ch wrote:\n\n> Is it possible to add an option akin to git-rev-list's '--ignore-missing' to\n> git-pack-objects?\n> \n> I use git bundles to (incrementally) backup my repositories. My script inspects\n> all bundles in the backup and passes their contained refs as excludes to\n> git-pack-objects to build the pack for the new bundle. This works fine as long\n> as none of these refs have been garbage-collected in the source repository.\n> Something like '--ignore-missing' would be really handy here to ask\n> git-pack-objects to simply ignore any of the passed revs that are not present\n> (anymore).\n\nSo if I understand correctly, you are only using these for the negative\nside of the traversal? rev-list should ignore missing objects in such a\ncase even without --ignore-missing, and I think it may simply be a bug\nif pack-objects is not.\n\nDo you have a simple reproduction recipe?\n\n-Peff\n"},{"id":"326820","messageId":"6b2b5649-f8a0-bf1e-3688-8a649b4ee5ad@onlinehome.de","threadId":"46586","inReplyTo":"20170820101632.irj22dighcrrcvlv@sigill.intra.peff.net","subject":"Re: Add --ignore-missing to git-pack-objects?","fromName":"ch","fromEmail":"cr@onlinehome.de","sentAt":"2017-08-20T16:05:21Z","receivedAt":"2017-08-20T16:05:33Z","isPatch":false,"sender":{"key":"cr@onlinehome.de","avatar":null},"body":"Hi Jeff.\n\nThanks a lot for your response.\n\nJeff King wrote:\n\n> So if I understand correctly, you are only using these for the negative\n> side of the traversal?\n\nYes.\n\nJeff King wrote:\n\n> rev-list should ignore missing objects in such a\n> case even without --ignore-missing, and I think it may simply be a bug\n> if pack-objects is not.\n> \n> Do you have a simple reproduction recipe?\n\nHere's a small bash script to illustrate the core issue:\n\n----\nadd_file()\n{\n     echo \"$1\" > \"$1\"\n     git add \"$1\"\n     git commit -m \"$1\"\n}\n\ngit init .\ngit config core.logAllRefUpdates false\n\nadd_file \"test-1\"\nadd_file \"test-2\"\n\ngit checkout -b feature\n\nadd_file \"test-3\"\nadd_file \"test-4\"\n\ngit checkout master\n\nadd_file \"test-5\"\nadd_file \"test-6\"\n\nfeature_tip=$(git rev-list -1 feature)\n\necho -e \"\\nDeleting branch 'feature' ($feature_tip)...\"\ngit branch -D feature\ngit gc --prune=now\n\necho -e \"\\nCalling git-pack-objects with (now deleted) ^$feature_tip...\"\ngit pack-objects --all --revs --stdout --thin --delta-base-offset --all-progress-implied <<< ^$feature_tip > pack\n\necho -e \"\\nCalling git-rev-list with (now deleted) ^$feature_tip...\"\ngit rev-list --all ^$feature_tip\n\necho -e \"\\nCalling git-rev-list --ignore-missing with (now deleted) ^$feature_tip...\"\ngit rev-list --all --ignore-missing ^$feature_tip\n----\n\nBoth, git-pack-objects and git-rev-list (without --ignore-missing) fail with\n\nfatal: bad object <feature_tip>\n\non git version 2.14.1.windows.1.\n"}]}