Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [BUG] Documentation: git log: --exit-code undocumented?

From: David Kastrup <hidden>
Date: 2016-06-15 23:03:09

Junio C Hamano [off-list ref] writes:
David Kastrup [off-list ref] writes:
quoted
I disagree that --exit-code does nothing: it indicates whether the
listed log is empty.  So for example

git log -1 --exit-code a..b > /dev/null

can be used to figure out whether "a" is a proper ancestor of "b" or
not.
Hmph.

    $ git log --exit-code master..maint >/dev/null; echo $?
    0
    $ git log --exit-code maint..master >/dev/null; echo $?
    1

That is a strange way to use --exit-code.  I suspect that if you did
this, you will get 0 from the log between HEAD~..HEAD

    $ git checkout master^0
    $ git commit --allow-empty -m empty
    $ git log --exit-code HEAD~..HEAD

even though HEAD~ is a proper ancestor of HEAD, so it is not giving
us anything useful.  Isn't it a mere artifact that "log" happens to
share the underlying machinery with "diff" that --exit-code shows a
non-zero exit when there is any single commit in the range that has
any change?
Possibly: I haven't checked the underlying code for the details.  At any
rate, it is an option git log accepts for whatever reason.

-- 
David Kastrup
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help