Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git-diff: must --exit-code work with --ignore* options?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:48

Jim Meyering [off-list ref] writes:
git-diff's --quiet option works how I'd expect with --ignore-space-at-eol
as long as I'm also using --no-index:

    $ echo>b; echo \ >c; git diff --no-index --quiet --ignore-space-at-eol b c \
      && echo good
    good

But in what I think of as normal operation (i.e., without --no-index),
--exit-code (or --quiet) makes git-diff say there were differences,
even when they have been ignored:

    # do this in an empty directory
    $ git init -q; echo>k; git add .; git commit -q -m. .; echo \ >k
    $ git diff --ignore-space-at-eol --quiet || echo bad
    bad
I am slightly torn about this, in that I can picture myself saying that
this is unintuitive on some different days, but not today ;-)

If you look at the output (i.e. no --quiet), you would see that the blob
changes are still reported for the path.  E.g.  you would see something
like...

	$ git diff --ignore-space-at-eol
        diff --git a/k b/k
        index 8b13789..8d1c8b6 100644

The "index" line is still showing that there _is_ a difference.

The --ignore-* options are there merely to tell git what changes are not
worth _showing_ in the textual part of the patch, in order to cut down the
amount of the output.  It never affects the outcome.

So if anything, I think --no-index codepath is what's buggy; if it does
not report the blob difference that is a different matter, though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help