Re: [GSoC][PATCH v3 2/3] cherry-pick/revert: add --skip option
- From
Rohit Ashiwal <rohit.ashiwal265@gmail.com>
- Date
- Jun 16, 2019, 07:03 UTC
- Message-ID
- <20190616070334.8834-1-rohit.ashiwal265@gmail.com>
- In-Reply-To
- <xmqqa7elwer9.fsf@gitster-ct.c.googlers.com>
Hi Junio
I am sorry, I missed to reply to these.
On 2019-06-13 17:56 UTC Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
>
> > +int sequencer_skip(struct repository *r, struct replay_opts *opts)
> > +{
> > + enum replay_action action = -1;
> > + sequencer_get_last_command(r, &action);
> > +
> > + switch (opts->action) {
> > + case REPLAY_REVERT:
> > + if (!file_exists(git_path_revert_head(r))) {
> > + if (action == REPLAY_REVERT) {
> > + if (!rollback_is_safe())
> > + goto give_advice;
> > + else
> > + break;
> > + }
> > + return error(_("no revert in progress"));
> > + }
>
> This part probably deserves a bit of in-code comment.
>
> The Git subcommand (i.e. opts->action) tells us that we are
> asked to "git revert --skip". When REVERT_HEAD is not there, we
> look at the last command of the sequencer state and make sure it
> is 'revert'; all other cases we barf.
>
> That much we can read from the code. But what are "all other cases"?
> Do we cover a single-revert case (i.e. "git revert <commit>" got
> conflict and the user is saying "git revert --skip")?Yes, we actually cover the single-revert case. Let's say there were some conflicts then either .git/REVERT_HEAD will exist allowing `git revert --skip` it's way or the user has already dealt with it and committed his way in which case .git/REVERT_HEAD will be removed and reverting ends (as it should).
> Was the user > in the middle of "git rebase -i" and the last command before we gave > the control back was 'pick'?
rebase -i creates different directories so, we are sure that --skip does not skip in middle of a rebase. Am I right?
Hope these answers your questions -- Rohit