Re: [PATCH] Don't use the pager when running "git diff --check"

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

 



Jeff King <peff@xxxxxxxx> 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

-
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]

  Powered by Linux