* git-diff: unable to turn off diff.autorefreshindex with command line switch
@ 2016-01-21 10:29 Andrew Stewart
2016-01-21 21:38 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Stewart @ 2016-01-21 10:29 UTC (permalink / raw)
To: git
Hello,
I 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.
# First I remove all my normal configs.
$ mv ~/.git* ~/stuff/
# Now some setup.
$ mkdir foo && cd foo
$ git init
$ echo 123 > README
$ git commit -am 'initial'
[master (root-commit) 92e793c] initial
...[stuff about name and email address being auto-configured]...
1 file changed, 1 insertion(+)
create mode 100644 README
$ touch README
# Now the strange behaviour: no output from the next command
$ git -c diff.autorefreshindex=0 diff --raw -- README
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
$ echo -e "[diff]\n autorefreshindex = 0" >> .git/config
$ touch README
# Next command works as expected.
$ git diff --raw -- README
:100644 100644 190a180... 0000000... M README
# Next command produces no output as expected
$ git -c diff.autorefreshindex=1 diff --raw -- README
I 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.
Any help would be much appreciated. Thanks in advance!
Yours,
Andrew Stewart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-diff: unable to turn off diff.autorefreshindex with command line switch
2016-01-21 10:29 git-diff: unable to turn off diff.autorefreshindex with command line switch Andrew Stewart
@ 2016-01-21 21:38 ` Jeff King
2016-01-22 14:12 ` Andrew Stewart
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2016-01-21 21:38 UTC (permalink / raw)
To: Andrew Stewart; +Cc: git
On Thu, Jan 21, 2016 at 10:29:49AM +0000, Andrew Stewart wrote:
> # Now the strange behaviour: no output from the next command
> $ git -c diff.autorefreshindex=0 diff --raw -- README
I can't reproduce here (v2.7.0, Linux).
But note that your whole test is going to be racy, and possibly depend
on the resolution of your filesystem's timestamps. Did you run your test
as a single script, where the initial index write and the `touch` may
happen in the same second? If so, trying running it slowly by hand,
or inserting "sleep 1" between the commands.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-diff: unable to turn off diff.autorefreshindex with command line switch
2016-01-21 21:38 ` Jeff King
@ 2016-01-22 14:12 ` Andrew Stewart
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Stewart @ 2016-01-22 14:12 UTC (permalink / raw)
To: Jeff King; +Cc: git
> On 21 Jan 2016, at 9:38 pm, Jeff King <peff@peff.net> wrote:
> But note that your whole test is going to be racy, and possibly depend
> on the resolution of your filesystem's timestamps. Did you run your test
> as a single script, where the initial index write and the `touch` may
> happen in the same second? If so, trying running it slowly by hand,
> or inserting "sleep 1" between the commands.
I ran my tests by hand, taking more than 1s between commands.
I also used `stat README` and `ls -l README` on occasion to confirm that `touch` was updating the file's timestamps.
-- Andrew Stewart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-22 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 10:29 git-diff: unable to turn off diff.autorefreshindex with command line switch Andrew Stewart
2016-01-21 21:38 ` Jeff King
2016-01-22 14:12 ` Andrew Stewart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).