{"thread":{"id":"37923","subject":"2.2.0-rc behavior changes (2/2)","startedAt":"2014-11-10T08:51:00Z","lastAt":"2014-11-10T10:45:22Z","messageCount":3,"participants":["Bryan Turner","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"251662","messageId":"CAGyf7-GWBWrV9SjMY3n3B-0gCMZGfEsYfX-0vSvz6GT6r=vO6A@mail.gmail.com","threadId":"37923","inReplyTo":null,"subject":"2.2.0-rc behavior changes (2/2)","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2014-11-10T08:51:00Z","receivedAt":"2014-11-10T08:51:00Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"I've been running a test suite we use to verify Git behaviors across\nversions, and the 2.2.0 RCs (0 and 1 both) have a couple of small\nbehavioral differences. I'm sending them in separate e-mails just to\nmake the contents easier to grok.\n\nImportant: It's entirely possible neither of these is a _bug_; they\nmay both be intentional changes in behavior.\n\nSecond change: git gc --auto now fails if there are loose empty blobs.\n\nWe have a test which just touched empty files in objects/17 to trigger\nthe gc --auto preconditions (Note: I realize this is completely\ninvalid, and I've changed the test to no longer do this; I'm only\nsurfacing the behavioral change).\n\nOn Xubuntu 14.10 I can reproduce this using bash with the following steps:\ngit init gc\ncd gc\necho Hello, world > file.txt\ngit add file.txt\ngit commit -m \"Initial commit\"\nmkdir .git/objects/17\ngit config gc.auto 2\ngit config --bool gc.autodetach false\nfor i in $(seq 1 20); do touch .git/objects/17/$(head -n 4096\n/dev/urandom | openssl sha1 | cut -c 10-47); done\n\n(openssl sha1 on my machine prefixes the SHA-1s with \"(stdin)= \", so\nthe cut is both to shorten the SHA-1 and to drop that prefix)\n\nIn 2.1.x and prior, git gc --auto appears to ignore those objects and\nexit 0, although it does note that there are still too many loose\nobjects:\nbturner@felurian:~/tmp/gc$ git version\ngit version 2.1.0\nbturner@felurian:~/tmp/gc$ git gc --auto\nAuto packing the repository for optimum performance.\nSee \"git help gc\" for manual housekeeping.\nNothing new to pack.\nwarning: There are too many unreachable loose objects; run 'git prune'\nto remove them.\n\nIn the 2.2.0 RCs git gc --auto exits with 255 and the following errors:\nbturner@felurian:~/tmp/gc$ /opt/git-2.2.0-rc1/bin/git gc --auto\nAuto packing the repository for optimum performance.\nSee \"git help gc\" for manual housekeeping.\nNothing new to pack.\nerror: object file\n.git/objects/17/02d54e8fba95ef9968a0c9b183fe22ec551c86 is empty\nfatal: unable to get object info for 1702d54e8fba95ef9968a0c9b183fe22ec551c86\nerror: failed to run prune\n\nMaking git gc more sensitive to invalid objects may be a good thing. I\nonly point out this behavior change because the change it bisects to\ndoesn't really cite this as an intentional change.\n\nThis change bisects to:\n\nbturner@felurian:~/Development/git/git$ git bisect good\nd3038d22f91aad9620bd8e6fc43fc67c16219738 is the first bad commit\ncommit d3038d22f91aad9620bd8e6fc43fc67c16219738\nAuthor: Jeff King <peff@peff.net>\nDate:   Wed Oct 15 18:41:35 2014 -0400\n\n    prune: keep objects reachable from recent objects\n\nBest regards,\nBryan Turner\n"},{"id":"251664","messageId":"20141110093128.GB11387@peff.net","threadId":"37923","inReplyTo":"CAGyf7-GWBWrV9SjMY3n3B-0gCMZGfEsYfX-0vSvz6GT6r=vO6A@mail.gmail.com","subject":"Re: 2.2.0-rc behavior changes (2/2)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-11-10T09:31:28Z","receivedAt":"2014-11-10T09:31:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 10, 2014 at 07:51:00PM +1100, Bryan Turner wrote:\n\n> Second change: git gc --auto now fails if there are loose empty blobs.\n> \n> We have a test which just touched empty files in objects/17 to trigger\n> the gc --auto preconditions (Note: I realize this is completely\n> invalid, and I've changed the test to no longer do this; I'm only\n> surfacing the behavioral change).\n\nThis is expected. As you noticed here:\n\n> error: object file\n> .git/objects/17/02d54e8fba95ef9968a0c9b183fe22ec551c86 is empty\n> fatal: unable to get object info for 1702d54e8fba95ef9968a0c9b183fe22ec551c86\n> error: failed to run prune\n\nthe error comes from \"git prune\" failing. It is using unreachable but\n\"recent\" objects as graph tips to keep around. If we can't load a tip\nobject, we abort the prune, because we would not want to delete objects\nthat might have been referenced (e.g., if it were a real corrupted\nobject that we could not read).\n\nThe second behavior (die on broken objects) has been around for a while.\nThe new change (in the commit you bisected to) is that we are\nconsidering more objects.\n\nI'll admit I didn't really consider the impact on sticking broken object\nfiles into the object directory, but I think the code is doing the\nsensible and safe thing.\n\n-Peff\n"},{"id":"251668","messageId":"CAGyf7-E0KCqqceH_PmE1Tsm=2bR-Qin1RV9s-fJa6oY2zdTU8A@mail.gmail.com","threadId":"37923","inReplyTo":"20141110093128.GB11387@peff.net","subject":"Re: 2.2.0-rc behavior changes (2/2)","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2014-11-10T10:45:22Z","receivedAt":"2014-11-10T10:45:22Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Mon, Nov 10, 2014 at 8:31 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Nov 10, 2014 at 07:51:00PM +1100, Bryan Turner wrote:\n>\n>> Second change: git gc --auto now fails if there are loose empty blobs.\n>>\n>> We have a test which just touched empty files in objects/17 to trigger\n>> the gc --auto preconditions (Note: I realize this is completely\n>> invalid, and I've changed the test to no longer do this; I'm only\n>> surfacing the behavioral change).\n>\n> This is expected. As you noticed here:\n>\n>> error: object file\n>> .git/objects/17/02d54e8fba95ef9968a0c9b183fe22ec551c86 is empty\n>> fatal: unable to get object info for 1702d54e8fba95ef9968a0c9b183fe22ec551c86\n>> error: failed to run prune\n>\n> the error comes from \"git prune\" failing. It is using unreachable but\n> \"recent\" objects as graph tips to keep around. If we can't load a tip\n> object, we abort the prune, because we would not want to delete objects\n> that might have been referenced (e.g., if it were a real corrupted\n> object that we could not read).\n>\n> The second behavior (die on broken objects) has been around for a while.\n> The new change (in the commit you bisected to) is that we are\n> considering more objects.\n>\n> I'll admit I didn't really consider the impact on sticking broken object\n> files into the object directory, but I think the code is doing the\n> sensible and safe thing.\n\nI agree. I wasn't aware this particular test was using such a\nquestionable mechanism to trigger automatic garbage collection. I\nthink the change to make git gc --auto more sensitive to this type of\nthing is definitely an improvement. As noted, I just wanted to surface\nthe behavior change.\n\nThanks again for your quick response!\n\n>\n> -Peff\n"}]}