From: Junio C Hamano <gitster@pobox.com>
To: Fabian Ruch <bafain@gmail.com>
Cc: git@vger.kernel.org, Phil Hord <hordp@cisco.com>
Subject: Re: [RFC 1/3] sequencer: Signal failed ff as an aborted, not a conflicted merge
Date: Tue, 27 May 2014 11:42:22 -0700 [thread overview]
Message-ID: <xmqqvbsrf4hd.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <5383BDE4.9000704@gmail.com> (Fabian Ruch's message of "Tue, 27 May 2014 00:19:16 +0200")
Fabian Ruch <bafain@gmail.com> writes:
> `do_pick_commit` handles three situations if it is not fast-forwarding.
> In order for `do_pick_commit` to identify the situation, it examines the
> return value of the selected merge command.
>
> 1. return value 0 stands for a clean merge
> 2. 1 is passed in case of a failed merge due to conflict
> 3. any other return value means that the merge did not even start
>
> So far, the sequencer returns 1 in case of a failed fast-forward, which
> would mean "failed merge due to conflict". However, a fast-forward
> either starts and succeeds or does not start at all. In particular, it
> cannot fail in between like a merge with a dirty index due to conflicts.
>
> In order to signal the three possible situations (not only success and
> failure to complete) after a pick through porcelain commands such as
> `cherry-pick`, exit with a return value that is neither 0 nor 1. -1 was
> chosen in line with the other situations in which the sequencer
> encounters an error.
Hmph... do we still pass negative to exit() anywhere in our codebase?
>
> Signed-off-by: Fabian Ruch <bafain@gmail.com>
> ---
> sequencer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 90cac7b..97cecca 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -278,7 +278,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
>
> read_cache();
> if (checkout_fast_forward(from, to, 1))
> - exit(1); /* the callee should have complained already */
> + exit(-1); /* the callee should have complained already */
> ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from,
> 0, NULL);
> strbuf_addf(&sb, "%s: fast-forward", action_name(opts));
next prev parent reply other threads:[~2014-05-27 18:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 22:37 git-rebase-todo gets popped prematurely Phil Hord
2014-05-26 22:19 ` [RFC 1/3] sequencer: Signal failed ff as an aborted, not a conflicted merge Fabian Ruch
2014-05-27 18:42 ` Junio C Hamano [this message]
2014-06-09 15:04 ` Fabian Ruch
2014-06-10 17:56 ` Junio C Hamano
2014-06-10 18:51 ` Phil Hord
2014-06-10 19:17 ` Junio C Hamano
2014-05-26 22:19 ` [RFC 2/3] rebase -i: Reschedule tasks that failed before the index was touched Fabian Ruch
2014-05-27 11:56 ` Michael Haggerty
2014-05-27 18:26 ` Phil Hord
2014-05-26 22:19 ` [RFC 3/3] tests: Add 'rebase -i commits that overwrite untracked files' Fabian Ruch
2014-05-27 13:15 ` Michael Haggerty
2014-05-27 18:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqvbsrf4hd.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=bafain@gmail.com \
--cc=git@vger.kernel.org \
--cc=hordp@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.