From: "Michael Montalbo via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Matthew Hughes" <matthewhughes934@gmail.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>,
"Michael Montalbo" <mmontalbo@gmail.com>,
"Michael Montalbo" <mmontalbo@gmail.com>
Subject: [PATCH v2 2/2] log: reject pickaxe options when combined with -L
Date: Wed, 04 Mar 2026 19:21:31 +0000 [thread overview]
Message-ID: <81cb521401210bfbcd05f8201f75e93bccfba712.1772652091.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2061.v2.git.1772652091.gitgitgadget@gmail.com>
From: Michael Montalbo <mmontalbo@gmail.com>
The previous commit fixed a crash when -G, -S, or --find-object was
used together with -L and rename detection. However, these options
still have no effect on -L output: line-log uses its own
commit-filtering logic in line_log_filter() and never consults the
pickaxe machinery. Rather than silently ignoring these options, reject
the combination with a clear error message.
This replaces the known-breakage tests from the previous commit with
tests that verify the rejection for all three options. A future series
could teach line-log to honor these options and remove this restriction.
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
---
builtin/log.c | 4 ++++
t/t4211-line-log.sh | 52 ++++++++-------------------------------------
2 files changed, 13 insertions(+), 43 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 5c9a8ef363..44e2399d59 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -317,6 +317,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
if (rev->line_level_traverse && rev->prune_data.nr)
die(_("-L<range>:<file> cannot be used with pathspec"));
+ if (rev->line_level_traverse &&
+ (rev->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
+ die(_("-L does not yet support -G, -S, or --find-object"));
+
memset(&w, 0, sizeof(w));
userformat_find_requirements(NULL, &w);
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index 7acc38f72d..8ebc73d2d9 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -367,53 +367,19 @@ test_expect_success 'show line-log with graph' '
test_cmp expect actual
'
-test_expect_success 'setup for -L with -G/-S/--find-object and a merge with rename' '
- git checkout --orphan pickaxe-rename &&
- git reset --hard &&
-
- echo content >file &&
- git add file &&
- git commit -m "add file" &&
-
- git checkout -b pickaxe-rename-side &&
- git mv file renamed-file &&
- git commit -m "rename file" &&
-
- git checkout pickaxe-rename &&
- git commit --allow-empty -m "diverge" &&
- git merge --no-edit pickaxe-rename-side &&
-
- git mv renamed-file file &&
- git commit -m "rename back"
-'
-
-test_expect_success '-L -G does not crash with merge and rename' '
- git log --format="%s" --no-patch -L 1,1:file -G "." >actual
-'
-
-test_expect_success '-L -S does not crash with merge and rename' '
- git log --format="%s" --no-patch -L 1,1:file -S content >actual
-'
-
-test_expect_success '-L --find-object does not crash with merge and rename' '
- git log --format="%s" --no-patch -L 1,1:file \
- --find-object=$(git rev-parse HEAD:file) >actual
-'
-
-test_expect_failure '-L -G should filter commits by pattern' '
- git log --format="%s" --no-patch -L 1,1:file -G "nomatch" >actual &&
- test_must_be_empty actual
+test_expect_success '-L with -G is rejected' '
+ test_must_fail git log -L 1,1:a.c -G "pattern" 2>err &&
+ test_grep "does not yet support" err
'
-test_expect_failure '-L -S should filter commits by pattern' '
- git log --format="%s" --no-patch -L 1,1:file -S "nomatch" >actual &&
- test_must_be_empty actual
+test_expect_success '-L with -S is rejected' '
+ test_must_fail git log -L 1,1:a.c -S "pattern" 2>err &&
+ test_grep "does not yet support" err
'
-test_expect_failure '-L --find-object should filter commits by object' '
- git log --format="%s" --no-patch -L 1,1:file \
- --find-object=$ZERO_OID >actual &&
- test_must_be_empty actual
+test_expect_success '-L with --find-object is rejected' '
+ test_must_fail git log -L 1,1:a.c --find-object=HEAD 2>err &&
+ test_grep "does not yet support" err
'
test_done
--
gitgitgadget
next prev parent reply other threads:[~2026-03-04 19:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 19:11 [PATCH 0/2] line-log: fix -L with pickaxe options Michael Montalbo via GitGitGadget
2026-03-04 19:11 ` [PATCH 1/2] line-log: fix crash when combined " Michael Montalbo via GitGitGadget
2026-03-04 20:01 ` Junio C Hamano
2026-03-04 22:33 ` Michael Montalbo
2026-03-04 19:11 ` [PATCH 2/2] log: reject pickaxe options when combined with -L Michael Montalbo via GitGitGadget
2026-03-04 19:21 ` [PATCH v2 0/2] line-log: fix -L with pickaxe options Michael Montalbo via GitGitGadget
2026-03-04 19:21 ` [PATCH v2 1/2] line-log: fix crash when combined " Michael Montalbo via GitGitGadget
2026-03-04 19:21 ` Michael Montalbo via GitGitGadget [this message]
2026-03-04 21:02 ` [PATCH v2 2/2] log: reject pickaxe options when combined with -L Junio C Hamano
2026-03-04 22:36 ` Michael Montalbo
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=81cb521401210bfbcd05f8201f75e93bccfba712.1772652091.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=matthewhughes934@gmail.com \
--cc=mmontalbo@gmail.com \
--cc=szeder.dev@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.