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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]