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

Re: false positives from git diff-index when used with --git-dir

From
Jeff King <peff@peff.net>
Date
Oct 14, 2010, 17:02 UTC
Message-ID
<20101014170227.GA14429@sigill.intra.peff.net>
In-Reply-To
<AANLkTimyeE=OLdC0Zzdnidr_dssFfkMzS+r_39dYUVxz@mail.gmail.com>
On Thu, Oct 14, 2010 at 06:40:51PM +0400, Alexander Gladysh wrote:
Show 14 quoted lines
> I'm *sometimes* (once in about ten times I use it -- repository
> changes between invocations of course) getting false positives from
> git diff-index when I invoke git from another directory:
> 
> git --git-dir=path/to/.git --work-tree=path/to update-index -q --refresh
> git --git-dir=path/to/.git --work-tree=path/to diff-index --exit-code
> --quiet HEAD
> 
> This is *really* annoying and really kills the benifits from my
> workflow automation scripts.
> 
> Unfortunately I can't find a reproducible use case for this bug.
> 
> Is there anything I can do to help catch it?
Can it reproduce over a large number of trials? I.e., something like:
  while true; do
    git ... update-index ...
    git ... diff-index ... || echo failed
  done

If so, try adding a "sleep 1" between the two commands. If that fixes it, it implies a race condition in git.

You could also try running under valgrind to see if there are any bad memory accesses, which could also produce intermittent buggy behavior.

-Peff
Previous: Alexander GladyshNext: Alexander Gladysh
Message 2 of 3 in “false positives from git diff-index when used with --git-dir”
  1. Alexander GladyshOct 14, 2010
  2. Jeff KingOct 14, 2010
  3. Alexander GladyshOct 14, 2010

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.