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

git diff --exit-code does not honour textconv setting

From
GPGeorg Pichler <georg.pichler@gmail.com>
Date
Mar 20, 2016, 12:43 UTC
Message-ID
<56EE9B09.6040700@gmail.com>
Hi,

I realized that "git diff --exit-code" does not honour textconv settings. Maybe this behaviour is desired. It can be partially circumvented by using the "-b" flag if one does not care about whitespace changes. To reproduce this, create an empty repository and run the following commands:

(I was using git version 2.7.3)

$ git config --add diff.void.textconv test $ echo "foo diff=void" >.gitattributes $ echo foo >foo $ git add . && git commit -m "Init" [master (root-commit) 70c39d9] Init 2 files changed, 2 insertions(+) create mode 100644 .gitattributes create mode 100644 foo $ echo bar >foo $ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)

modified: foo

no changes added to commit (use "git add" and/or "git commit -a") $ git diff $ git diff --exit-code [exits with 1, no output] $ git diff --exit-code -b [exits with 0, no output]

The "test" command is used as it does not generate any output on stdout.

I would expect "git diff --exit-code" to return with exit code 0. If this is not desired, it should be clearly stated in the man page, that "--exit-code" does not honour the textconv setting, except if "-b" is given. Currently this is not clear:

       --exit-code
           Make the program exit with codes similar to diff(1). That is, it exits
           with 1 if there were differences and 0 means no differences.

Best, Georg Pichler

Next: Michael J Gruber
Message 1 of 4 in “git diff --exit-code does not honour textconv setting”
  1. Georg PichlerMar 20, 2016
  2. Michael J GruberApr 5, 2016
  3. Junio C HamanoApr 5, 2016
  4. Michael J GruberApr 6, 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.