Re: [BUG] Documentation: git log: --exit-code undocumented?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 1, 2014, 17:49 UTC
- Message-ID
- <xmqqwq6bp8ey.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <874mtfl1hx.fsf@fencepost.gnu.org>
David Kastrup <dak@gnu.org> writes:
Show 7 quoted lines
> 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 $?
1That 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~..HEADeven 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?