git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Michał Kępień" <michal@isc.org>
Subject: Re: [PATCH 1/2] combine-diff: abort if --ignore-matching-lines is given
Date: Tue, 21 Jun 2022 17:58:50 +0200	[thread overview]
Message-ID: <95d7609e-4cb5-c87e-0120-144f1f094241@web.de> (raw)
In-Reply-To: <xmqqedzijago.fsf@gitster.g>

Am 21.06.22 um 17:35 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>> The code for combined diffs doesn't currently support ignoring changes
>> that match a regex.  Abort and report that fact instead of running into
>> a segfault.
>>
>> Signed-off-by: René Scharfe <l.s.r@web.de>
>> ---
>>  combine-diff.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
> Makes sense.
>
>> diff --git a/combine-diff.c b/combine-diff.c
>> index b724f02123..11df1d7f39 100644
>> --- a/combine-diff.c
>> +++ b/combine-diff.c
>> @@ -1498,6 +1498,10 @@ void diff_tree_combined(const struct object_id *oid,
>>  	int i, num_paths, needsep, show_log_first, num_parent = parents->nr;
>>  	int need_generic_pathscan;
>>
>> +	if (opt->ignore_regex_nr)
>> +		die("combined diff and '%s' cannot be used together",
>> +		    "--ignore-matching-lines");
>
> "X cannot be used together _with_ Y" perhaps?

Not sure, but that type of message was recently unified (most common
case: "options '%s' and '%s' cannot be used together") and "with" is
only used in an untranslated BUG:

$ git grep -e "cannot be used together" --and --not -e options '*.c'
builtin/add.c:                  die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
builtin/am.c:                                      "cannot be used together"),
builtin/checkout.c:                     die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
builtin/clean.c:                die(_("-x and -X cannot be used together"));
builtin/commit.c:                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
builtin/commit.c:               die(_("reword option of '%s' and path '%s' cannot be used together"), "--fixup", *argv);
builtin/commit.c:               die(_("reword option of '%s' and '%s' cannot be used together"),
builtin/describe.c:             die(_("option '%s' and commit-ishes cannot be used together"), "--dirty");
builtin/describe.c:             die(_("option '%s' and commit-ishes cannot be used together"), "--broken");
builtin/rebase.c:                                         "cannot be used together"));
builtin/reset.c:                        die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
builtin/rev-list.c:             die(_("marked counting and '%s' cannot be used together"), "--objects");
builtin/rm.c:                   die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
builtin/stash.c:                        die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
revision.c:                     BUG("--single-worktree cannot be used together with submodule");
upload-pack.c:          die("git upload-pack: deepen and deepen-since (or deepen-not) cannot be used together");

So there doesn't seem to be a fully consistent style amongst these
special cases.  How about this?

		die(_("option '%s' and combined diffs cannot be used together"),

>
>>  	/* nothing to do, if no parents */
>>  	if (!num_parent)
>>  		return;
>> --
>> 2.36.1

  reply	other threads:[~2022-06-21 16:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14  9:32 Bug: combined diff with --ignore-matching-lines René Scharfe
2022-05-23 18:31 ` [PATCH] diff: fix a segfault in >2 tree -I<regex> and --output=<file> Ævar Arnfjörð Bjarmason
2022-05-23 20:08   ` Junio C Hamano
2022-05-24 11:38     ` Ævar Arnfjörð Bjarmason
2022-05-24 19:38       ` Junio C Hamano
2022-05-24 20:17         ` Ævar Arnfjörð Bjarmason
2022-06-18 11:12           ` René Scharfe
2022-06-18 11:12           ` [PATCH 1/2] combine-diff: abort if --ignore-matching-lines is given René Scharfe
2022-06-21 15:35             ` Junio C Hamano
2022-06-21 15:58               ` René Scharfe [this message]
2022-06-21 16:55                 ` Junio C Hamano
2022-06-18 11:12           ` [PATCH 2/2] combine-diff: abort if --output " René Scharfe

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95d7609e-4cb5-c87e-0120-144f1f094241@web.de \
    --to=l.s.r@web.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=michal@isc.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.
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).