From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Wincent Colaiuta <win@wincent.com>, git@vger.kernel.org
Subject: Re: [PATCH] Don't use the pager when running "git diff --check"
Date: Thu, 13 Dec 2007 21:11:45 -0800 [thread overview]
Message-ID: <7vmysdx3la.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20071214045127.GC10169@sigill.intra.peff.net> (Jeff King's message of "Thu, 13 Dec 2007 23:51:27 -0500")
Jeff King <peff@peff.net> writes:
> On Thu, Dec 13, 2007 at 08:45:38PM +0100, Wincent Colaiuta wrote:
>
>> In 89d07f75 "git diff" learnt to not run the pager if the user passes
>> the --exit-code switch. This commit does the same for the --check
>> switch for the same reason: we want the user to get the exit status
>> from "git diff", not the pager.
>
> But --check is also producing useful output, which might need paged. So
> you are sacrificing existing interactive use of --check for scriptable
> exit-code uses. If you really want the exit code, why not "git diff
> --check --exit-code"?
>
> OTOH, I am not too sad to lose the paging behavior; it would take quite
> a few whitespace errors to scroll off the screen.
You are right. While I do not personally miss paging output, it is a
regression not to page --check output by default.
By the way, there is no reason to make --check and --exit-code mutually
exclusive either. You could say with --exit-code the command will exit
with status 01 or'ed in if trees are not identical, and with --check the
command will exit with status 02 or'ed in. Loosely written scripted
callers can continue doing:
if git --no-pager diff --exit-code
then
they are different
fi
if git --no-pager diff --check
then
there are funky blanks
fi
while the ones that are aware of the new behaviour of --check can:
git --no-pager diff --check --exit-code
case $? in
0) all is well ;;
1) clean difference there ;;
3) dirty difference there ;;
2) cannot happen ;;
*) bombed out, as die exits with 128 ;;
esac
next prev parent reply other threads:[~2007-12-14 5:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 13:32 [PATCH 0/5] "diff --check" and whitespace enhancements Wincent Colaiuta
2007-12-13 13:32 ` [PATCH 1/5] "diff --check" should affect exit status Wincent Colaiuta
2007-12-13 13:32 ` [PATCH 2/5] New version of pre-commit hook Wincent Colaiuta
2007-12-13 13:32 ` [PATCH 3/5] Unify whitespace checking Wincent Colaiuta
2007-12-13 13:32 ` [PATCH 4/5] Make "diff --check" output match "git apply" Wincent Colaiuta
2007-12-13 13:32 ` [PATCH 5/5] Add tests for "git diff --check" with core.whitespace options Wincent Colaiuta
2007-12-14 0:55 ` Junio C Hamano
2007-12-14 0:12 ` [PATCH 4/5] Make "diff --check" output match "git apply" Junio C Hamano
2007-12-13 13:40 ` [PATCH 3/5] Unify whitespace checking Andreas Ericsson
2007-12-14 0:03 ` Junio C Hamano
2007-12-14 7:36 ` Wincent Colaiuta
2007-12-14 0:17 ` [PATCH 2/5] New version of pre-commit hook Jakub Narebski
2007-12-14 7:24 ` Wincent Colaiuta
2007-12-14 10:23 ` Jakub Narebski
2007-12-13 19:45 ` [PATCH] Don't use the pager when running "git diff --check" Wincent Colaiuta
2007-12-14 4:51 ` Jeff King
2007-12-14 5:11 ` Junio C Hamano [this message]
2007-12-14 7:33 ` Junio C Hamano
2007-12-14 7:51 ` Wincent Colaiuta
2007-12-14 7:57 ` Junio C Hamano
2007-12-14 7:47 ` Wincent Colaiuta
2007-12-14 20:54 ` Junio C Hamano
2007-12-13 23:51 ` [PATCH 1/5] "diff --check" should affect exit status Junio C Hamano
2007-12-14 2:10 ` Junio C Hamano
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=7vmysdx3la.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=win@wincent.com \
/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.