Subject: 24.0.95; vc-git-state bug
From: Leo <[email-masked]>
To: [email-masked]
Date: Thu, 26 Apr 2012 13:26:55 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

1. Open a file in a git repo
2. Insert any char and then delete it
3. Save

You will see emacs show in the mode-line "Git:<branch>" i.e. file is
modified. Because in this case, git diff-index -p --raw -z HEAD --
<file> outputs:

 :100644 100644 c617ed851b3c4d332ab960b0f936c6c4fafce1b0 0000000000000000000000000000000000000000 MTODOdiff --git a/TODO b/TODO

The manual page of git-diff-index says:

  <sha1> is shown as all 0's if a file is new on the filesystem and it
  is out of sync with the index.

But showing it as modified is not helpful and is contradictory to
behaviour in other backends.

One possible solution is to run `git update-index -- <file>' before
running git diff-index as mentioned above. But I am not familiar with
git plumbing commands.

Leo