Hello,
$ git help log | grep exit-code
problems are found. Not compatible with --exit-code.
$What --exit-code does in "git log"?
-- Sergey.
threads / bug / 38085
Subject: [BUG] Documentation: git log: --exit-code undocumented?
Hello,
$ git help log | grep exit-code
problems are found. Not compatible with --exit-code.
$What --exit-code does in "git log"?
-- Sergey.
Re: [BUG] Documentation: git log: --exit-code undocumented?
Sergey Organov <sorganov@gmail.com> writes:
> Hello, > > $ git help log | grep exit-code > problems are found. Not compatible with --exit-code. > $ > > What --exit-code does in "git log"?
It doesn't. That is why it is not listed.
Re: [BUG] Documentation: git log: --exit-code undocumented?
Junio C Hamano <gitster@pobox.com> writes:
> Sergey Organov <sorganov@gmail.com> writes: > >> Hello, >> >> $ git help log | grep exit-code >> problems are found. Not compatible with --exit-code. >> $ >> >> What --exit-code does in "git log"? > > It doesn't. That is why it is not listed.
Then, how can --check possibly interfer with it?
-- Sergey.
Re: [BUG] Documentation: git log: --exit-code undocumented?
Sergey Organov <sorganov@gmail.com> writes:
> Junio C Hamano <gitster@pobox.com> writes: > >> Sergey Organov <sorganov@gmail.com> writes: >> >>> Hello, >>> >>> $ git help log | grep exit-code >>> problems are found. Not compatible with --exit-code. >>> $ >>> >>> What --exit-code does in "git log"? >> >> It doesn't. That is why it is not listed. > > Then, how can --check possibly interfer with it?
The description is shared with "git diff" and friends, which is invoked via "git log -p". As "log" does not give the exit code of individual "diff-tree" invocation for each commit, --exit-code option is irrelevant.
Re: [BUG] Documentation: git log: --exit-code undocumented?
Junio C Hamano <gitster@pobox.com> writes:
> Sergey Organov <sorganov@gmail.com> writes: > >> Junio C Hamano <gitster@pobox.com> writes: >> >>> Sergey Organov <sorganov@gmail.com> writes: >>> >>>> Hello, >>>> >>>> $ git help log | grep exit-code >>>> problems are found. Not compatible with --exit-code. >>>> $ >>>> >>>> What --exit-code does in "git log"? >>> >>> It doesn't. That is why it is not listed. >> >> Then, how can --check possibly interfer with it? > > The description is shared with "git diff" and friends, which is > invoked via "git log -p". As "log" does not give the exit code > of individual "diff-tree" invocation for each commit, --exit-code > option is irrelevant.
Do you agree there is some minor problem here? First, "git log" silently eats the --exit-code option that does nothing. Next, git-log manual page doesn't include --exit-log description while refers to it elsewhere. What's proposed resulution?
-- Sergey.
Re: [BUG] Documentation: git log: --exit-code undocumented?
Junio C Hamano <gitster@pobox.com> writes:
> Sergey Organov <sorganov@gmail.com> writes: > >> Hello, >> >> $ git help log | grep exit-code >> problems are found. Not compatible with --exit-code. >> $ >> >> What --exit-code does in "git log"? > > It doesn't. That is why it is not listed.
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.
-- David Kastrup
Re: [BUG] Documentation: git log: --exit-code undocumented?
David Kastrup <dak@gnu.org> writes:
> 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?
Re: [BUG] Documentation: git log: --exit-code undocumented?
Junio C Hamano <gitster@pobox.com> writes:
> David Kastrup <dak@gnu.org> writes: > >> 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
Re: [BUG] Documentation: git log: --exit-code undocumented?
Junio C Hamano <gitster@pobox.com> writes:
> David Kastrup <dak@gnu.org> writes: > >> 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.
What's the best way then to tell if "a" is an ancestor of "b"?
-- Sergey.
Re: [BUG] Documentation: git log: --exit-code undocumented?
On Tue, Dec 02, 2014 at 02:30:31PM +0300, Sergey Organov wrote:
> Junio C Hamano <gitster@pobox.com> writes: > > > David Kastrup <dak@gnu.org> writes: > > > >> 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. > > What's the best way then to tell if "a" is an ancestor of "b"?
git merge-base --is-ancestor a b