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

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.js
I'm working on git 1.9.2.
⁓ ELLIOTTCABLE — fly safe.
  http://ell.io/tt
Next: Jeff King
Message 1 of 3 in “Strange situation with --assume-unchanged and diff --find-copies-harder”
  1. Elliott CableMay 11, 2014
  2. run_diff_files: do not look at uninitialized stat dataJeff King, May 14, 2014
  3. Junio C HamanoMay 15, 2014

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.