From e3d1be4237b831b517a54c70ae3c4ec3840345a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 18 Jun 2022 13:12:28 +0200 Subject: [PATCH 1/2] combine-diff: abort if --ignore-matching-lines is given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- combine-diff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/combine-diff.c b/combine-diff.c index d93782daeb..512897e3bf 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"); + /* nothing to do, if no parents */ if (!num_parent) return; From cfb19ae05f4565bc9d0a0cb3a23a3d2ab9fb8fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 18 Jun 2022 13:12:34 +0200 Subject: [PATCH 2/2] combine-diff: abort if --output is given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code for combined diffs currently only writes to stdout. Abort and report that fact instead of silently ignoring the --output option. The (empty) output file has already been created at that point, though. Reported-by: Ævar Arnfjörð Bjarmason Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- combine-diff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/combine-diff.c b/combine-diff.c index 512897e3bf..76d2351fce 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1501,6 +1501,9 @@ void diff_tree_combined(const struct object_id *oid, if (opt->ignore_regex_nr) die("combined diff and '%s' cannot be used together", "--ignore-matching-lines"); + if (opt->close_file) + die("combined diff and '%s' cannot be used together", + "--output"); /* nothing to do, if no parents */ if (!num_parent)