{"thread":{"id":"41235","subject":"git-diff: unable to turn off diff.autorefreshindex with command line switch","startedAt":"2016-01-21T10:29:49Z","lastAt":"2016-01-22T14:12:15Z","messageCount":3,"participants":["Andrew Stewart","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"276494","messageId":"4432B7DA-921D-4D1C-8DC5-55A4E3722F73@airbladesoftware.com","threadId":"41235","inReplyTo":null,"subject":"git-diff: unable to turn off diff.autorefreshindex with command line switch","fromName":"Andrew Stewart","fromEmail":"boss@airbladesoftware.com","sentAt":"2016-01-21T10:29:49Z","receivedAt":"2016-01-21T10:29:49Z","isPatch":false,"sender":{"key":"boss@airbladesoftware.com","avatar":null},"body":"Hello,\n\nI am seeing unexpected behaviour on my system with git-diff and stat-only changes: diff.autorefreshindex=0 only works when in a repo's config (./.git/config); it doesn't work via a -c switch.  Conversely -c diff.autorefreshindex=1 does indeed override a 0 setting in the repo's config.\n\n# First I remove all my normal configs.\n$ mv ~/.git* ~/stuff/\n\n# Now some setup.\n$ mkdir foo && cd foo\n$ git init\n$ echo 123 > README\n$ git commit -am 'initial'\n[master (root-commit) 92e793c] initial\n ...[stuff about name and email address being auto-configured]...\n 1 file changed, 1 insertion(+)\n create mode 100644 README\n$ touch README\n\n# Now the strange behaviour: no output from the next command\n$ git -c diff.autorefreshindex=0 diff --raw -- README\n\n$ cat .git/config\n[core]\n\trepositoryformatversion = 0\n\tfilemode = true\n\tbare = false\n\tlogallrefupdates = true\n\tignorecase = true\n\tprecomposeunicode = true\n\n$ echo -e \"[diff]\\n  autorefreshindex = 0\" >> .git/config\n$ touch README\n\n# Next command works as expected.\n$ git diff --raw -- README\n:100644 100644 190a180... 0000000... M  README\n\n# Next command produces no output as expected\n$ git -c diff.autorefreshindex=1 diff --raw -- README\n\nI get this with both git v2.6.4 and v2.7.0 on my OS X 10.11.2.  I tried it on another system (Ubuntu 12.04 LTS, git 1.7.9.5) and everything worked as expected.  Somebody else tried it on their OS X 10.11.2 (as well as 10.10.something) with git 2.5.4 and everything worked as expected.\n\nAny help would be much appreciated.  Thanks in advance!\n\nYours,\nAndrew Stewart\n"},{"id":"276514","messageId":"20160121213801.GB6664@sigill.intra.peff.net","threadId":"41235","inReplyTo":"4432B7DA-921D-4D1C-8DC5-55A4E3722F73@airbladesoftware.com","subject":"Re: git-diff: unable to turn off diff.autorefreshindex with command line switch","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-01-21T21:38:01Z","receivedAt":"2016-01-21T21:38:01Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 21, 2016 at 10:29:49AM +0000, Andrew Stewart wrote:\n\n> # Now the strange behaviour: no output from the next command\n> $ git -c diff.autorefreshindex=0 diff --raw -- README\n\nI can't reproduce here (v2.7.0, Linux).\n\nBut note that your whole test is going to be racy, and possibly depend\non the resolution of your filesystem's timestamps. Did you run your test\nas a single script, where the initial index write and the `touch` may\nhappen in the same second? If so, trying running it slowly by hand,\nor inserting \"sleep 1\" between the commands.\n\n-Peff\n"},{"id":"276539","messageId":"5BAA7C36-0059-4F0B-96B6-7B6E66D7C315@airbladesoftware.com","threadId":"41235","inReplyTo":"20160121213801.GB6664@sigill.intra.peff.net","subject":"Re: git-diff: unable to turn off diff.autorefreshindex with command line switch","fromName":"Andrew Stewart","fromEmail":"boss@airbladesoftware.com","sentAt":"2016-01-22T14:12:15Z","receivedAt":"2016-01-22T14:12:15Z","isPatch":false,"sender":{"key":"boss@airbladesoftware.com","avatar":null},"body":"> On 21 Jan 2016, at 9:38 pm, Jeff King <peff@peff.net> wrote:\n> But note that your whole test is going to be racy, and possibly depend\n> on the resolution of your filesystem's timestamps. Did you run your test\n> as a single script, where the initial index write and the `touch` may\n> happen in the same second? If so, trying running it slowly by hand,\n> or inserting \"sleep 1\" between the commands.\n\nI ran my tests by hand, taking more than 1s between commands.\n\nI also used `stat README` and `ls -l README` on occasion to confirm that `touch` was updating the file's timestamps.\n\n-- Andrew Stewart"}]}