Skip to contentSkip to conversation

Stranges with git-diff-index

DISCUSSION Сергей Шарыбин 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

I've found this strange thing in git diff-index. I've got a clear work tree (all changes are commited). Then I've changed some files. After this I've run git diff-index --name-status HEAD and this command showed me changed files. After this I've undid this changes (I did this myself, not using git-reset or any stuff like this). But when I run this command again it showed me that this files are still changed. After this I've run git-status and it told me that there is nothing to commit. And after this git-diff-index tells me that there is no changed files too.

I think it's not normal.

Signature · 1 line
With best regards, Sergey I. Sharybin
#1 lore raw
Quoted 10 lines · Сергей Шарыбин

I've found this strange thing in git diff-index. I've got a clear work tree (all changes are commited). Then I've changed some files. After this I've run git diff-index --name-status HEAD and this command showed me changed files. After this I've undid this changes (I did this myself, not using git-reset or any stuff like this). But when I run this command again it showed me that this files are still changed. After this I've run git-status and it told me that there is nothing to commit. And after this git-diff-index tells me that there is no changed files too.

I think it's not normal.

That's perfectly normal.

Low-level git commands ("plumbing", like git diff-index) doesn't look at the file contents, only at the stat information. Next time use 'git diff --name-status HEAD'; it wouldn't have reported any changes.

-- Hannes