git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* bug with git merge-base
@ 2018-09-19 22:25 Alexander Mills
  2018-09-21  2:31 ` Eric Sunshine
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Mills @ 2018-09-19 22:25 UTC (permalink / raw)
  To: git

The following command sequence exits with 1, and no stderr

base='remotes/origin/dev';
fork_point="$(git merge-base --fork-point "$base")";

I cannot figure out why it's exiting with 1, but there is no stdout/stderr

-alex

-- 

Alexander D. Mills
¡¡¡ New cell phone number: (415)730-1805 !!!
alexander.d.mills@gmail.com

www.linkedin.com/pub/alexander-mills/b/7a5/418/

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

* Re: bug with git merge-base
  2018-09-19 22:25 bug with git merge-base Alexander Mills
@ 2018-09-21  2:31 ` Eric Sunshine
  2018-09-21  4:05   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sunshine @ 2018-09-21  2:31 UTC (permalink / raw)
  To: alexander.d.mills; +Cc: Git List

On Wed, Sep 19, 2018 at 6:25 PM Alexander Mills
<alexander.d.mills@gmail.com> wrote:
> The following command sequence exits with 1, and no stderr
>
> base='remotes/origin/dev';
> fork_point="$(git merge-base --fork-point "$base")";
>
> I cannot figure out why it's exiting with 1, but there is no stdout/stderr

Unable to reproduce the problem. Perhaps you can provide more context.

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

* Re: bug with git merge-base
  2018-09-21  2:31 ` Eric Sunshine
@ 2018-09-21  4:05   ` Junio C Hamano
  2018-09-21  4:59     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2018-09-21  4:05 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: alexander.d.mills, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Wed, Sep 19, 2018 at 6:25 PM Alexander Mills
> <alexander.d.mills@gmail.com> wrote:
>> The following command sequence exits with 1, and no stderr
>>
>> base='remotes/origin/dev';
>> fork_point="$(git merge-base --fork-point "$base")";
>>
>> I cannot figure out why it's exiting with 1, but there is no stdout/stderr
>
> Unable to reproduce the problem. Perhaps you can provide more context.

Well, reading builtin/merge-base.c::handle_fork_point(), I think the
intended behaviour is:

 - die() when input is not well formed (e.g. bad commit object,
   ambigous ref name, etc.); there is an error worth reporting in
   this case.

 - show one that used to sit at the tip of the ref, if exists, and
   signal success with exit status 0; there of course is no error in
   this case.

 - if there is no such fork point found, signal failure with exit
   status 1; nothing is written to the standard output as there is
   no fork point to be shown, and nothing is written to the standard
   error.

I do not think the code considers the last case as an error, i.e. it
is just as natural not to have any fork point, as there is one.

It might be OK to teach the command to say "no fork point found" to
the standard error under "--verbose" mode in the last case, but
since the command does not take --verbose or --quiet, I have a
feeling that everything is working as designed.

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

* Re: bug with git merge-base
  2018-09-21  4:05   ` Junio C Hamano
@ 2018-09-21  4:59     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-09-21  4:59 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: alexander.d.mills, Git List

Junio C Hamano <gitster@pobox.com> writes:

> Well, reading builtin/merge-base.c::handle_fork_point(), I think the
> intended behaviour is:
>
>  - die() when input is not well formed (e.g. bad commit object,
>    ambigous ref name, etc.); there is an error worth reporting in
>    this case.
>
>  - show one that used to sit at the tip of the ref, if exists, and
>    signal success with exit status 0; there of course is no error in
>    this case.
>
>  - if there is no such fork point found, signal failure with exit
>    status 1; nothing is written to the standard output as there is
>    no fork point to be shown, and nothing is written to the standard
>    error.
>
> I do not think the code considers the last case as an error, i.e. it
> is just as natural not to have any fork point, as there is one.
>
> It might be OK to teach the command to say "no fork point found" to
> the standard error under "--verbose" mode in the last case, but
> since the command does not take --verbose or --quiet, I have a
> feeling that everything is working as designed.

I forgot to say that the behaviour above used by the "fork point"
mode seems to match the behaviour of the more established normal
"merge base" mode.  builtin/merge-base.c::show_merge_base() also
follows the same "die if the input is faulty, give output and
succeed if a merge base is found, otherwise be silent and signal
failure with exit code" pattern.

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

end of thread, other threads:[~2018-09-21  4:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 22:25 bug with git merge-base Alexander Mills
2018-09-21  2:31 ` Eric Sunshine
2018-09-21  4:05   ` Junio C Hamano
2018-09-21  4:59     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).