git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Documentation: git log: --exit-code undocumented?
@ 2014-12-01 11:50 Sergey Organov
  2014-12-01 16:29 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Sergey Organov @ 2014-12-01 11:50 UTC (permalink / raw)
  To: git

Hello,

$ git help log | grep exit-code
           problems are found. Not compatible with --exit-code.
$

What --exit-code does in "git log"?

-- 
Sergey.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 11:50 [BUG] Documentation: git log: --exit-code undocumented? Sergey Organov
@ 2014-12-01 16:29 ` Junio C Hamano
  2014-12-01 16:32   ` Sergey Organov
  2014-12-01 17:32   ` David Kastrup
  0 siblings, 2 replies; 10+ messages in thread
From: Junio C Hamano @ 2014-12-01 16:29 UTC (permalink / raw)
  To: Sergey Organov; +Cc: git

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 16:29 ` Junio C Hamano
@ 2014-12-01 16:32   ` Sergey Organov
  2014-12-01 16:37     ` Junio C Hamano
  2014-12-01 17:32   ` David Kastrup
  1 sibling, 1 reply; 10+ messages in thread
From: Sergey Organov @ 2014-12-01 16:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 16:32   ` Sergey Organov
@ 2014-12-01 16:37     ` Junio C Hamano
  2014-12-01 16:43       ` Sergey Organov
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2014-12-01 16:37 UTC (permalink / raw)
  To: Sergey Organov; +Cc: git

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 16:37     ` Junio C Hamano
@ 2014-12-01 16:43       ` Sergey Organov
  0 siblings, 0 replies; 10+ messages in thread
From: Sergey Organov @ 2014-12-01 16:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 16:29 ` Junio C Hamano
  2014-12-01 16:32   ` Sergey Organov
@ 2014-12-01 17:32   ` David Kastrup
  2014-12-01 17:49     ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: David Kastrup @ 2014-12-01 17:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sergey Organov, git

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 17:32   ` David Kastrup
@ 2014-12-01 17:49     ` Junio C Hamano
  2014-12-01 18:30       ` David Kastrup
  2014-12-02 11:30       ` Sergey Organov
  0 siblings, 2 replies; 10+ messages in thread
From: Junio C Hamano @ 2014-12-01 17:49 UTC (permalink / raw)
  To: David Kastrup; +Cc: Sergey Organov, git

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?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 17:49     ` Junio C Hamano
@ 2014-12-01 18:30       ` David Kastrup
  2014-12-02 11:30       ` Sergey Organov
  1 sibling, 0 replies; 10+ messages in thread
From: David Kastrup @ 2014-12-01 18:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sergey Organov, git

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-01 17:49     ` Junio C Hamano
  2014-12-01 18:30       ` David Kastrup
@ 2014-12-02 11:30       ` Sergey Organov
  2014-12-02 12:27         ` John Keeping
  1 sibling, 1 reply; 10+ messages in thread
From: Sergey Organov @ 2014-12-02 11:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: David Kastrup, git

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Documentation: git log: --exit-code undocumented?
  2014-12-02 11:30       ` Sergey Organov
@ 2014-12-02 12:27         ` John Keeping
  0 siblings, 0 replies; 10+ messages in thread
From: John Keeping @ 2014-12-02 12:27 UTC (permalink / raw)
  To: Sergey Organov; +Cc: Junio C Hamano, David Kastrup, git

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-12-02 12:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 11:50 [BUG] Documentation: git log: --exit-code undocumented? Sergey Organov
2014-12-01 16:29 ` Junio C Hamano
2014-12-01 16:32   ` Sergey Organov
2014-12-01 16:37     ` Junio C Hamano
2014-12-01 16:43       ` Sergey Organov
2014-12-01 17:32   ` David Kastrup
2014-12-01 17:49     ` Junio C Hamano
2014-12-01 18:30       ` David Kastrup
2014-12-02 11:30       ` Sergey Organov
2014-12-02 12:27         ` John Keeping

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).