Strange situation with --assume-unchanged and diff --find-copies-harder
- From
Elliott Cable <me@ell.io>
- Date
- May 11, 2014, 19:20 UTC
- Message-ID
- <CAPZ477Ot8MiTUNx1AwDTb5sGDDerDvBY=znsK4Fhcb5taYsaHA@mail.gmail.com>
So, I've spent some time in the #git channel on Freenode chatting about this, and we couldn't figure it out. I can't reproduce it in a newly-made repository, but it's reproducible with the repository I've been working in.
> git status
On branch Master
Your branch is ahead of 'ec/Master' by 2 commits.
(use "git push" to publish your local commits) nothing to commit, working directory clean
> g diff --find-copies-harder
diff --git i/Executables/paws.js w/Executables/paws.js
old mode 100755
new mode 100644
> stat -f '%p' Executables/paws.js
100755
>- As demonstrated by the `stat`, the mode-change shown by `git diff` is a phantom change; it never happened. - If I remove the `--find-copies-harder` flag, it doesn't show up. - If I choose to --no-assume-unchanged the executable, it doesn't show up. - If I change the actual file-mode to the 644 it thinks it is, and commit it, it doesn't show up.
It's only the precise combination of A) a file flagged +x, B) that file --assume-unchange'd on the index, and C) diff called with the --find-copies-harder flag, that shows the phantom mode-change.
I tried reproducing that situation in a clean repository, and the problem didn't seem to surface. You're welcome to clone the repository in question, however, and reproduce it yourself:
> git clone https://github.com/ELLIOTTCABLE/Paws.js.git
> git update-index --assume-unchanged Executables/paws.js
> git diff --find-copies-harder
> stat -f '%p' Executables/paws.jsI'm working on git 1.9.2.
⁓ ELLIOTTCABLE — fly safe. http://ell.io/tt