git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de,
	"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH 2/2] builtin/add: make clear edit and patch/interactive are incompatible
Date: Mon, 16 Aug 2021 23:44:35 -0700	[thread overview]
Message-ID: <20210817064435.97625-3-carenas@gmail.com> (raw)
In-Reply-To: <20210817064435.97625-1-carenas@gmail.com>

c59cb03a8b (git-add: introduce --edit (to edit the diff vs. the index),
2009-04-08) add the option to add an edited patch directly to the index
interactively, but was silently ignored if any of the other interactive
options was also selected.

report the user there is a conflict instead of silently ignoring -e
and while at it remove a variable assignment which was never used.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 builtin/add.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index a15b5be220..be1920ab37 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -308,7 +308,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 	repo_init_revisions(the_repository, &rev, prefix);
 	rev.diffopt.context = 7;
 
-	argc = setup_revisions(argc, argv, &rev, NULL);
+	setup_revisions(argc, argv, &rev, NULL);
 	rev.diffopt.output_format = DIFF_FORMAT_PATCH;
 	rev.diffopt.use_color = 0;
 	rev.diffopt.flags.ignore_dirty_submodules = 1;
@@ -486,6 +486,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 			die(_("--dry-run is incompatible with --interactive/--patch"));
 		if (pathspec_from_file)
 			die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
+		if (edit_interactive)
+			die(_("--edit-interactive is incompatible with --interactive/--patch"));
 		exit(interactive_add(argv + 1, prefix, patch_interactive));
 	}
 
-- 
2.33.0.476.gf000ecbed9


  parent reply	other threads:[~2021-08-17  6:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17  6:44 [PATCH 0/2] builtin/add: minor unrelated fixes Carlo Marcelo Arenas Belón
2021-08-17  6:44 ` [PATCH 1/2] builtin/add: remove obsoleted support for legacy stash -p Carlo Marcelo Arenas Belón
2021-08-31  0:33   ` Taylor Blau
2021-08-17  6:44 ` Carlo Marcelo Arenas Belón [this message]
2021-08-17 10:05   ` [PATCH 2/2] builtin/add: make clear edit and patch/interactive are incompatible Johannes Schindelin

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=20210817064435.97625-3-carenas@gmail.com \
    --to=carenas@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /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).