git-diff not showing changes (corrupt repo?)

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

git-diff not showing changes (corrupt repo?)

From: Dan Zwell <hidden>
Date: 2016-06-15 22:43:37

Hi,
A small personal git repository has started lying to me about changed 
files. git-diff sometimes tells me that the index has no changes from 
HEAD, while other commands (git-status, at least) seem to tell the 
truth. It is the same after I commit the new changes--at that point, 
"git-diff-tree HEAD^ HEAD -p" spits out a nice patch, but "git-diff 
HEAD^ HEAD" gives nothing.

I have tried git versions 1.5.1.6-1.5.3.3, and they all act the same, so 
I think the repository is corrupt. Does sound familiar to anybody? If 
this is user error (for example, "git-reset --hard HEAD^" on a branch 
that had already been pulled into another branch), I can restore from a 
recent backup and redo some changes, but I would like to help 
troubleshoot this behavior if it is a git bug. Is this a known behavior? 
git-fsck doesn't reveal anything amiss, besides dangling objects. Does 
anybody know anything about this situation or what can cause it?


Example of behavior:

$ git status
# On branch bak_linear-checks3
nothing to commit (working directory clean)
$ echo "test" >> Makefile
$ git status
# On branch bak_linear-checks3
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   Makefile
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
$

Thanks,
Dan

Re: git-diff not showing changes (corrupt repo?)

From: Jeff King <hidden>
Date: 2016-06-15 22:43:37

On Tue, Oct 02, 2007 at 01:55:16PM -0500, Dan Zwell wrote:
A small personal git repository has started lying to me about changed files. 
git-diff sometimes tells me that the index has no changes from HEAD, while 
other commands (git-status, at least) seem to tell the truth. It is the same 
Perhaps you are confused by the fact that "git-diff" with no options
shows the difference between the index and the working tree? Did you try
"git-diff --cached"?
after I commit the new changes--at that point, "git-diff-tree HEAD^ HEAD -p" 
spits out a nice patch, but "git-diff HEAD^ HEAD" gives nothing.
That doesn't seem right. Can you reproduce this, or at least show us the
command you used?
$ git status
# On branch bak_linear-checks3
nothing to commit (working directory clean)
$ echo "test" >> Makefile
$ git status
# On branch bak_linear-checks3
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   Makefile
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
$
OK, that does seem wrong. If you run git-diff-files, does it produce the
expected output?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help