git/list[1] front-page[2] threads[3] people[4] search[5] about
 

bug: git fetch reports too many unreachable loose objects

From
JWJosh Wolfe <josh@okcupid.com>
Date
Dec 8, 2018, 02:12 UTC
Message-ID
<CAKQQkGppdO5pwOpG+sJ0uc2uPW867TZzWzc0ZntPd6MkqsozFQ@mail.gmail.com>

git version 2.19.1 steps to reproduce:

# start in a brand new repo git init

# create lots of unreachable loose objects
for i in {1..10000}; do git commit-tree -m "$(head -c 12 /dev/urandom
| base64)" "$(git mktree <&-)" <&-; done
# this prints a lot of output and takes a minute or so to run

# trigger git gc to run in the background git fetch # Auto packing the repository in background for optimum performance. # See "git help gc" for manual housekeeping.

# trigger it again git fetch # Auto packing the repository in background for optimum performance. # See "git help gc" for manual housekeeping. # error: The last gc run reported the following. Please correct the root cause # and remove .git/gc.log. # Automatic cleanup will not be performed until the file is removed. # # warning: There are too many unreachable loose objects; run 'git prune' to remove them.

# to manually fix this, run git prune: git prune

# note that `git gc` does not fix the problem, and appears to do nothing in this situation: git gc

According to the `git fetch` output, the `git help gc` docs, and the `git help prune` docs, I don't think I shouldn't ever have to run `git prune` manually, so this behavior seems like a bug to me. Please correct me if this is expected behavior.

In case anyone's wondering why I'm creating unreachable loose objects, here's the usecase: https://stackoverflow.com/a/50403179/367916 . I would love a first-class solution to obviate that workaround, but that is probably a separate issue.

Josh
Next: Elijah Newren
Message 1 of 2 in “bug: git fetch reports too many unreachable loose objects”
  1. Josh WolfeDec 8, 2018
  2. Elijah NewrenDec 8, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.