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

git-diff: unable to turn off diff.autorefreshindex with command line switch

From
ASAndrew Stewart <boss@airbladesoftware.com>
Date
Jan 21, 2016, 10:29 UTC
Message-ID
<4432B7DA-921D-4D1C-8DC5-55A4E3722F73@airbladesoftware.com>
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

Next: Jeff King
Message 1 of 3 in “git-diff: unable to turn off diff.autorefreshindex with command line switch”
  1. Andrew StewartJan 21, 2016
  2. Jeff KingJan 21, 2016
  3. Andrew StewartJan 22, 2016

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.