git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git diff --exit-code does not honour textconv setting
@ 2016-03-20 12:43 Georg Pichler
  2016-04-05 14:22 ` Michael J Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Georg Pichler @ 2016-03-20 12:43 UTC (permalink / raw)
  To: git


[-- Attachment #1.1: Type: text/plain, Size: 1552 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-06  6:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 12:43 git diff --exit-code does not honour textconv setting Georg Pichler
2016-04-05 14:22 ` Michael J Gruber
2016-04-05 23:16   ` Junio C Hamano
2016-04-06  6:44     ` Michael J Gruber

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).