git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-diff: must --exit-code work with --ignore* options?
@ 2009-05-22 14:01 Jim Meyering
  2009-05-22 16:14 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Jim Meyering @ 2009-05-22 14:01 UTC (permalink / raw)
  To: git list

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

Same problem with --ignore-space-change.

-------------------
In the surprising case, builtin-diff.c's builtin_diff_files calls
diff_result_code, which returns nonzero due to this:

          if (diff_queued_diff.nr)
                  DIFF_OPT_SET(options, HAS_CHANGES);
          else
                  DIFF_OPT_CLR(options, HAS_CHANGES);

However, the queued diffs may contain only ignorable changes.

With --no-index, it takes a different code path and uses
diffopt.found_changes to produce the desired exit status.

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

end of thread, other threads:[~2009-09-08 20:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-22 14:01 git-diff: must --exit-code work with --ignore* options? Jim Meyering
2009-05-22 16:14 ` Junio C Hamano
2009-05-22 17:54   ` Jim Meyering
2009-05-22 20:40     ` Junio C Hamano
2009-05-23  7:26       ` Jim Meyering
2009-08-30 16:25       ` Jim Meyering
2009-08-30 20:11         ` Junio C Hamano
2009-08-30 20:27           ` Jim Meyering
2009-09-08 20:58           ` Thell Fowler

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