git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Christian Couder <chriscool@tuxfamily.org>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 7/8] revert: Implement parsing --continue, --abort and --skip
Date: Wed, 11 May 2011 07:59:51 -0500	[thread overview]
Message-ID: <20110511125900.GH2676@elie> (raw)
In-Reply-To: <1305100822-20470-8-git-send-email-artagnon@gmail.com>

Ramkumar Ramachandra wrote:

> Introduce three new command-line options: --continue, --abort, and
> --skip resembling the correspoding options in "rebase -i".  For now,
> just parse the options into the replay_opts structure, making sure
> that two of them are not specified together. They will actually be
> implemented later in the series.

I'd suggest squashing this patch with the next one.  If a "git
cherry-pick" accepting an --abort option that does not do anything
leaked into the wild, that would not be a good outcome.

> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -145,7 +153,47 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
>  	opts->xopts_nr = xopts_nr;
>  	opts->xopts_alloc = xopts_alloc;
>  
> -	if (opts->commit_argc < 2)
> +	/* Check for incompatible command line arguments */
> +	if (opts->abort_oper || opts->skip_oper || opts->continue_oper) {
> +		char *this_oper;
> +		if (opts->abort_oper) {
> +			this_oper = "--abort";
> +			die_opt_incompatible(me, this_oper,
> +					"--skip", opts->skip_oper,
> +					NULL);
> +			die_opt_incompatible(me, this_oper,
> +					"--continue", opts->continue_oper,
> +					NULL);

What happened to

			...(me, "--abort",
				"--skip", opts->skip,
				"--continue", opts->continue);

?  I also wonder if there should not be a function to deal with
mutually incompatible options:

	va_start(ap, commandname);
	while ((arg1 = va_arg(ap, const char *))) {
		int set = va_arg(ap, int);
		if (set)
			break;
	}
	while ((arg2 = va_arg(ap, const char *))) {
		int set = va_arg(ap, int);
		if (set)
			die(arg1 and arg2 are incompatible);
	}
	va_end(ap);

> +		die_opt_incompatible(me, this_oper,
> +				"--no-commit", opts->no_commit,
[...]

Seems reasonable.  A part of me would want to accept such options and
only error out if the saved state indicates that they are different
from the options supplied before, so if a person has

	alias applycommits = git cherry-pick --no-commit

then "applycommits --continue" could work without trouble, but
that's probably overegineering.

  reply	other threads:[~2011-05-11 15:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  8:00 [PATCH 0/8] Sequencer Foundations Ramkumar Ramachandra
2011-05-11  8:00 ` [PATCH 1/8] revert: Improve error handling by cascading errors upwards Ramkumar Ramachandra
2011-05-11  9:59   ` Jonathan Nieder
2011-05-13 10:30     ` Ramkumar Ramachandra
2011-05-19 10:39     ` Ramkumar Ramachandra
     [not found]     ` <20110519091831.GA28723@ramkum.desktop.amazon.com>
2011-05-19 18:03       ` Jonathan Nieder
2011-05-20  6:39         ` Ramkumar Ramachandra
2011-05-11  8:00 ` [PATCH 2/8] revert: Make "commit" and "me" local variables Ramkumar Ramachandra
2011-05-11 10:37   ` Jonathan Nieder
2011-05-13 10:02     ` Ramkumar Ramachandra
2011-05-13 21:40   ` Daniel Barkalow
2011-05-11  8:00 ` [PATCH 3/8] revert: Introduce a struct to parse command-line options into Ramkumar Ramachandra
2011-05-11 11:24   ` Jonathan Nieder
2011-05-13  9:32     ` Ramkumar Ramachandra
2011-05-13 10:07       ` Jonathan Nieder
2011-05-13 10:22         ` Ramkumar Ramachandra
2011-05-11  8:00 ` [PATCH 4/8] revert: Separate cmdline argument handling from the functional code Ramkumar Ramachandra
2011-05-11 11:49   ` Jonathan Nieder
2011-05-13  9:09     ` Ramkumar Ramachandra
2011-05-13  9:35       ` Ramkumar Ramachandra
2011-05-13  9:44         ` Jonathan Nieder
2011-05-11  8:00 ` [PATCH 5/8] revert: Catch incompatible command-line options early Ramkumar Ramachandra
2011-05-11 12:06   ` Jonathan Nieder
2011-05-13 10:07     ` Ramkumar Ramachandra
2011-05-11  8:00 ` [PATCH 6/8] revert: Introduce head, todo, done files to persist state Ramkumar Ramachandra
2011-05-11 12:47   ` Jonathan Nieder
2011-05-13 10:21     ` Ramkumar Ramachandra
2011-05-11  8:00 ` [PATCH 7/8] revert: Implement parsing --continue, --abort and --skip Ramkumar Ramachandra
2011-05-11 12:59   ` Jonathan Nieder [this message]
2011-05-13  9:16     ` Ramkumar Ramachandra
2011-05-13  9:40       ` Jonathan Nieder
2011-05-11  8:00 ` [PATCH 8/8] revert: Implement --abort processing Ramkumar Ramachandra
2011-05-11 13:14 ` [PATCH 0/8] Sequencer Foundations Jonathan Nieder
2011-05-12  8:19   ` Christian Couder
2011-05-12  8:41     ` Jonathan Nieder
2011-05-12 11:44       ` Jonathan Nieder
2011-05-13  9:11         ` Christian Couder
2011-05-13 10:37           ` Jonathan Nieder
2011-05-16  4:14             ` Christian Couder

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=20110511125900.GH2676@elie \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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).