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

2.2.0-rc behavior changes (2/2)

From
Bryan Turner <bturner@atlassian.com>
Date
Nov 10, 2014, 08:51 UTC
Message-ID
<CAGyf7-GWBWrV9SjMY3n3B-0gCMZGfEsYfX-0vSvz6GT6r=vO6A@mail.gmail.com>

I've been running a test suite we use to verify Git behaviors across versions, and the 2.2.0 RCs (0 and 1 both) have a couple of small behavioral differences. I'm sending them in separate e-mails just to make the contents easier to grok.

Important: It's entirely possible neither of these is a _bug_; they
may both be intentional changes in behavior.
Second change: git gc --auto now fails if there are loose empty blobs.

We have a test which just touched empty files in objects/17 to trigger the gc --auto preconditions (Note: I realize this is completely invalid, and I've changed the test to no longer do this; I'm only surfacing the behavioral change).

On Xubuntu 14.10 I can reproduce this using bash with the following steps: git init gc cd gc echo Hello, world > file.txt git add file.txt git commit -m "Initial commit" mkdir .git/objects/17 git config gc.auto 2 git config --bool gc.autodetach false for i in $(seq 1 20); do touch .git/objects/17/$(head -n 4096 /dev/urandom | openssl sha1 | cut -c 10-47); done

(openssl sha1 on my machine prefixes the SHA-1s with "(stdin)= ", so the cut is both to shorten the SHA-1 and to drop that prefix)

In 2.1.x and prior, git gc --auto appears to ignore those objects and exit 0, although it does note that there are still too many loose objects: bturner@felurian:~/tmp/gc$ git version git version 2.1.0 bturner@felurian:~/tmp/gc$ git gc --auto Auto packing the repository for optimum performance. See "git help gc" for manual housekeeping. Nothing new to pack. warning: There are too many unreachable loose objects; run 'git prune' to remove them.

In the 2.2.0 RCs git gc --auto exits with 255 and the following errors: bturner@felurian:~/tmp/gc$ /opt/git-2.2.0-rc1/bin/git gc --auto Auto packing the repository for optimum performance. See "git help gc" for manual housekeeping. Nothing new to pack. error: object file .git/objects/17/02d54e8fba95ef9968a0c9b183fe22ec551c86 is empty fatal: unable to get object info for 1702d54e8fba95ef9968a0c9b183fe22ec551c86 error: failed to run prune

Making git gc more sensitive to invalid objects may be a good thing. I only point out this behavior change because the change it bisects to doesn't really cite this as an intentional change.

This change bisects to:
bturner@felurian:~/Development/git/git$ git bisect good
d3038d22f91aad9620bd8e6fc43fc67c16219738 is the first bad commit
commit d3038d22f91aad9620bd8e6fc43fc67c16219738
Author: Jeff King <peff@peff.net>
Date:   Wed Oct 15 18:41:35 2014 -0400
    prune: keep objects reachable from recent objects

Best regards, Bryan Turner

Next: Jeff King
Message 1 of 3 in “2.2.0-rc behavior changes (2/2)”
  1. Bryan TurnerNov 10, 2014
  2. Jeff KingNov 10, 2014
  3. Bryan TurnerNov 10, 2014

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.