All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ferreira <jferreira@nvidia.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: "git diff --no-index" Implies "--exit-code"
Date: Wed, 27 Nov 2019 04:03:48 +0000	[thread overview]
Message-ID: <MN2PR12MB289677B16DBF67772627B595DE440@MN2PR12MB2896.namprd12.prod.outlook.com> (raw)

I suspect this may be a bug:
Because I am not specifying the "--exit-code" flag,  I expect "git diff --no-index" to have the same exit code style as git diff.
But it does not.  
See comment in source linked below.  
Or, if this is intended, this side effect should be noted in the documentation for --no-index.

https://git-scm.com/docs/git-diff
--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.

git diff [<options>] --no-index [--] <path> <path>
This form is to compare the given two paths on the filesystem. You can omit the --no-index option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git.


https://github.com/git/git/blob/83232e38648b51abbcbdb56c94632b6906cc85a6/diff-no-index.c#L307
/*
 * The return code for --no-index imitates diff(1):
 * 0 = no changes, 1 = changes, else error
*/
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

             reply	other threads:[~2019-11-27  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27  4:03 John Ferreira [this message]
2019-11-27  8:46 ` "git diff --no-index" Implies "--exit-code" Denton Liu

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=MN2PR12MB289677B16DBF67772627B595DE440@MN2PR12MB2896.namprd12.prod.outlook.com \
    --to=jferreira@nvidia.com \
    --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.