All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering.net>
To: git list <git@vger.kernel.org>
Subject: git-diff: must --exit-code work with --ignore* options?
Date: Fri, 22 May 2009 16:01:57 +0200	[thread overview]
Message-ID: <87k549dyne.fsf@meyering.net> (raw)

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.

             reply	other threads:[~2009-05-22 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 14:01 Jim Meyering [this message]
2009-05-22 16:14 ` git-diff: must --exit-code work with --ignore* options? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k549dyne.fsf@meyering.net \
    --to=jim@meyering.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.