{"thread":{"id":"49976","subject":"bug: git fetch reports too many unreachable loose objects","startedAt":"2018-12-08T02:12:39Z","lastAt":"2018-12-08T02:23:39Z","messageCount":2,"participants":["Josh Wolfe","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"364784","messageId":"CAKQQkGppdO5pwOpG+sJ0uc2uPW867TZzWzc0ZntPd6MkqsozFQ@mail.gmail.com","threadId":"49976","inReplyTo":null,"subject":"bug: git fetch reports too many unreachable loose objects","fromName":"Josh Wolfe","fromEmail":"josh@okcupid.com","sentAt":"2018-12-08T02:12:24Z","receivedAt":"2018-12-08T02:12:39Z","isPatch":false,"sender":{"key":"josh@okcupid.com","avatar":null},"body":"git version 2.19.1\nsteps to reproduce:\n\n# start in a brand new repo\ngit init\n\n# create lots of unreachable loose objects\nfor i in {1..10000}; do git commit-tree -m \"$(head -c 12 /dev/urandom\n| base64)\" \"$(git mktree <&-)\" <&-; done\n# this prints a lot of output and takes a minute or so to run\n\n# trigger git gc to run in the background\ngit fetch\n# Auto packing the repository in background for optimum performance.\n# See \"git help gc\" for manual housekeeping.\n\n# trigger it again\ngit fetch\n# Auto packing the repository in background for optimum performance.\n# See \"git help gc\" for manual housekeeping.\n# error: The last gc run reported the following. Please correct the root cause\n# and remove .git/gc.log.\n# Automatic cleanup will not be performed until the file is removed.\n#\n# warning: There are too many unreachable loose objects; run 'git\nprune' to remove them.\n\n# to manually fix this, run git prune:\ngit prune\n\n# note that `git gc` does not fix the problem, and appears to do\nnothing in this situation:\ngit gc\n\n\nAccording to the `git fetch` output, the `git help gc` docs, and the\n`git help prune` docs, I don't think I shouldn't ever have to run `git\nprune` manually, so this behavior seems like a bug to me. Please\ncorrect me if this is expected behavior.\n\nIn case anyone's wondering why I'm creating unreachable loose objects,\nhere's the usecase: https://stackoverflow.com/a/50403179/367916 . I\nwould love a first-class solution to obviate that workaround, but that\nis probably a separate issue.\n\nJosh\n"},{"id":"364786","messageId":"CABPp-BE_fvO-pcAT6hYNK2+M0Bt63XhyvZFF3wrrcNp4MsjtYg@mail.gmail.com","threadId":"49976","inReplyTo":"CAKQQkGppdO5pwOpG+sJ0uc2uPW867TZzWzc0ZntPd6MkqsozFQ@mail.gmail.com","subject":"Re: bug: git fetch reports too many unreachable loose objects","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-08T02:23:16Z","receivedAt":"2018-12-08T02:23:39Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Dec 7, 2018 at 6:14 PM Josh Wolfe <josh@okcupid.com> wrote:\n>\n> git version 2.19.1\n> steps to reproduce:\n>\n> # start in a brand new repo\n> git init\n>\n> # create lots of unreachable loose objects\n> for i in {1..10000}; do git commit-tree -m \"$(head -c 12 /dev/urandom\n> | base64)\" \"$(git mktree <&-)\" <&-; done\n> # this prints a lot of output and takes a minute or so to run\n>\n> # trigger git gc to run in the background\n> git fetch\n> # Auto packing the repository in background for optimum performance.\n> # See \"git help gc\" for manual housekeeping.\n>\n> # trigger it again\n> git fetch\n> # Auto packing the repository in background for optimum performance.\n> # See \"git help gc\" for manual housekeeping.\n> # error: The last gc run reported the following. Please correct the root cause\n> # and remove .git/gc.log.\n> # Automatic cleanup will not be performed until the file is removed.\n> #\n> # warning: There are too many unreachable loose objects; run 'git\n> prune' to remove them.\n>\n> # to manually fix this, run git prune:\n> git prune\n>\n> # note that `git gc` does not fix the problem, and appears to do\n> nothing in this situation:\n> git gc\n>\n>\n> According to the `git fetch` output, the `git help gc` docs, and the\n> `git help prune` docs, I don't think I shouldn't ever have to run `git\n> prune` manually, so this behavior seems like a bug to me. Please\n> correct me if this is expected behavior.\n\nKnown bug, there are a variety of other ways to trigger it too.  See\nthe threads here for more info:\n  https://public-inbox.org/git/87inc89j38.fsf@evledraar.gmail.com/\n  https://public-inbox.org/git/20180716172717.237373-1-jonathantanmy@google.com/\nThere are probably other threads as well.\n"}]}