{"thread":{"id":"66017","subject":"[PATCH] revision: fix --no-walk path filtering regression","startedAt":"2026-07-16T10:48:03Z","lastAt":"2026-07-16T19:35:55Z","messageCount":3,"participants":["Kristofer Karlsson via GitGitGadget","Junio C Hamano","Peter Colberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"548396","messageId":"pull.2181.git.1784198879711.gitgitgadget@gmail.com","threadId":"66017","inReplyTo":null,"subject":"[PATCH] revision: fix --no-walk path filtering regression","fromName":"Kristofer Karlsson via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-07-16T10:47:58Z","receivedAt":"2026-07-16T10:48:03Z","isPatch":true,"body":"From: Kristofer Karlsson <krka@spotify.com>\n\nSince dd4bc01c0a (revision: use priority queue for non-limited\nstreaming walks, 2026-05-27), \"git rev-list --no-walk <commit>\n-- <path>\" ignores the path arguments and outputs all commits\nregardless of whether they touch the given paths.\n\nThat commit introduced a REV_WALK_NO_WALK enum value to separate\n--no-walk from the streaming walk in get_revision_1(). The new\ncase skips process_parents(), which is correct for not enqueuing\nparents, but also skips try_to_simplify_commit() which\nprocess_parents() calls to evaluate whether each commit touches\nthe given paths.\n\nAdd a call to try_to_simplify_commit() for the\nREV_WALK_NO_WALK case, folding it into the existing\nREV_WALK_REFLOG case which already does the same.\n\nAdd tests for --no-walk path filtering to t6017. The\n\"single commit, match\" test is defensive and passes without\nthe fix, while the other two fail without it.\n\nReported-by: Peter Colberg <pcolberg@redhat.com>\nSigned-off-by: Kristofer Karlsson <krka@spotify.com>\n---\n    revision: fix --no-walk path filtering regression\n    \n    Fix for a regression reported by Peter Colberg [1] where git rev-list\n    --no-walk <commit> -- <path> ignores path arguments since dd4bc01c0a.\n    \n    Verified against linux.git with the exact example from the report:\n    \n    git rev-list --topo-order v7.0..v7.1 -- drivers/gpu/drm/ |\n    git rev-list --stdin --no-walk=unsorted -- ':!drivers/gpu/drm/'\n    \n    \n    Without fix: 2026 commits (all pass through unfiltered) With fix: 146\n    commits (correctly filtered)\n    \n    [1]\n    https://lore.kernel.org/git/CAL71e4NjDTHbKR8z7pSrPpzDrX19JOTR04sArm7P=m5ivqkskA@mail.gmail.com/T/#u\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2181%2Fspkrka%2Fkk%2Fno-walk-pathspec-fix-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2181/spkrka/kk/no-walk-pathspec-fix-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2181\n\n revision.c                |  2 +-\n t/t6017-rev-list-stdin.sh | 18 ++++++++++++++++++\n 2 files changed, 19 insertions(+), 1 deletion(-)\n\ndiff --git a/revision.c b/revision.c\nindex ccbe2e03d1..e990e3f96b 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -4419,6 +4419,7 @@ static struct commit *get_revision_1(struct rev_info *revs)\n \n \t\tswitch (mode) {\n \t\tcase REV_WALK_REFLOG:\n+\t\tcase REV_WALK_NO_WALK:\n \t\t\ttry_to_simplify_commit(revs, commit);\n \t\t\tbreak;\n \t\tcase REV_WALK_TOPO:\n@@ -4432,7 +4433,6 @@ static struct commit *get_revision_1(struct rev_info *revs)\n \t\t\t\t\t    oid_to_hex(&commit->object.oid));\n \t\t\t}\n \t\t\tbreak;\n-\t\tcase REV_WALK_NO_WALK:\n \t\tcase REV_WALK_LIMITED:\n \t\t\tbreak;\n \t\t}\ndiff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh\nindex 4821b90e74..32284f1831 100755\n--- a/t/t6017-rev-list-stdin.sh\n+++ b/t/t6017-rev-list-stdin.sh\n@@ -148,4 +148,22 @@ test_expect_success '--not via stdin does not influence revisions from command l\n \ttest_cmp expect actual\n '\n \n+test_expect_success '--no-walk filters by path (single commit, match)' '\n+\tgit rev-parse side-1 >expect &&\n+\tgit rev-list --no-walk side-1 -- file-1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success '--no-walk filters by path (single commit, no match)' '\n+\tgit rev-list --no-walk side-2 -- file-1 >actual &&\n+\ttest_must_be_empty actual\n+'\n+\n+test_expect_success '--no-walk with pathspec exclusion' '\n+\tgit rev-parse side-3 side-2 >expect &&\n+\tgit rev-parse side-1 side-2 side-3 >input &&\n+\tgit rev-list --stdin --no-walk -- \":!file-1\" <input >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n\nbase-commit: d35c5399e3e54ac277bb391fc2f6be3e816d312b\n-- \ngitgitgadget\n"},{"id":"548444","messageId":"xmqq4ihyhl2e.fsf@gitster.g","threadId":"66017","inReplyTo":"pull.2181.git.1784198879711.gitgitgadget@gmail.com","subject":"Re: [PATCH] revision: fix --no-walk path filtering regression","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-16T17:59:53Z","receivedAt":"2026-07-16T17:59:55Z","isPatch":true,"body":"\"Kristofer Karlsson via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Kristofer Karlsson <krka@spotify.com>\n>\n> Since dd4bc01c0a (revision: use priority queue for non-limited\n> streaming walks, 2026-05-27), \"git rev-list --no-walk <commit>\n> -- <path>\" ignores the path arguments and outputs all commits\n> regardless of whether they touch the given paths.\n>\n> That commit introduced a REV_WALK_NO_WALK enum value to separate\n> --no-walk from the streaming walk in get_revision_1(). The new\n> case skips process_parents(), which is correct for not enqueuing\n> parents, but also skips try_to_simplify_commit() which\n> process_parents() calls to evaluate whether each commit touches\n> the given paths.\n>\n> Add a call to try_to_simplify_commit() for the\n> REV_WALK_NO_WALK case, folding it into the existing\n> REV_WALK_REFLOG case which already does the same.\n>\n> Add tests for --no-walk path filtering to t6017. The\n> \"single commit, match\" test is defensive and passes without\n> the fix, while the other two fail without it.\n>\n> Reported-by: Peter Colberg <pcolberg@redhat.com>\n> Signed-off-by: Kristofer Karlsson <krka@spotify.com>\n> ---\n>     revision: fix --no-walk path filtering regression\n>     \n>     Fix for a regression reported by Peter Colberg [1] where git rev-list\n>     --no-walk <commit> -- <path> ignores path arguments since dd4bc01c0a.\n>     \n>     Verified against linux.git with the exact example from the report:\n>     \n>     git rev-list --topo-order v7.0..v7.1 -- drivers/gpu/drm/ |\n>     git rev-list --stdin --no-walk=unsorted -- ':!drivers/gpu/drm/'\n>     \n>     \n>     Without fix: 2026 commits (all pass through unfiltered) With fix: 146\n>     commits (correctly filtered)\n>     \n>     [1]\n>     https://lore.kernel.org/git/CAL71e4NjDTHbKR8z7pSrPpzDrX19JOTR04sArm7P=m5ivqkskA@mail.gmail.com/T/#u\n\nOK.  Without this fix, a commit that applied this patch (which does\nnot touch Makefile) shows the commit message in\n\n    $ git show HEAD -- Makefile\n\nbut with this fix, just like Git 2.54 did, the command stays silent.\n\nWill queue.  Thanks.\n"},{"id":"548449","messageId":"alkylqTvbci7AKLe@earendel","threadId":"66017","inReplyTo":"pull.2181.git.1784198879711.gitgitgadget@gmail.com","subject":"Re: [PATCH] revision: fix --no-walk path filtering regression","fromName":"Peter Colberg","fromEmail":"pcolberg@redhat.com","sentAt":"2026-07-16T19:35:50Z","receivedAt":"2026-07-16T19:35:55Z","isPatch":true,"body":"Hi Kristofer,\n\nOn Thu, Jul 16, 2026 at 10:47:58AM +0000, Kristofer Karlsson via GitGitGadget wrote:\n> From: Kristofer Karlsson <krka@spotify.com>\n> \n> Since dd4bc01c0a (revision: use priority queue for non-limited\n> streaming walks, 2026-05-27), \"git rev-list --no-walk <commit>\n> -- <path>\" ignores the path arguments and outputs all commits\n> regardless of whether they touch the given paths.\n> \n> That commit introduced a REV_WALK_NO_WALK enum value to separate\n> --no-walk from the streaming walk in get_revision_1(). The new\n> case skips process_parents(), which is correct for not enqueuing\n> parents, but also skips try_to_simplify_commit() which\n> process_parents() calls to evaluate whether each commit touches\n> the given paths.\n> \n> Add a call to try_to_simplify_commit() for the\n> REV_WALK_NO_WALK case, folding it into the existing\n> REV_WALK_REFLOG case which already does the same.\n> \n> Add tests for --no-walk path filtering to t6017. The\n> \"single commit, match\" test is defensive and passes without\n> the fix, while the other two fail without it.\n> \n> Reported-by: Peter Colberg <pcolberg@redhat.com>\n> Signed-off-by: Kristofer Karlsson <krka@spotify.com>\n\nThank you very much for the fix, which passes as well for my use case.\n\nPeter\n\n> ---\n>     revision: fix --no-walk path filtering regression\n>     \n>     Fix for a regression reported by Peter Colberg [1] where git rev-list\n>     --no-walk <commit> -- <path> ignores path arguments since dd4bc01c0a.\n>     \n>     Verified against linux.git with the exact example from the report:\n>     \n>     git rev-list --topo-order v7.0..v7.1 -- drivers/gpu/drm/ |\n>     git rev-list --stdin --no-walk=unsorted -- ':!drivers/gpu/drm/'\n>     \n>     \n>     Without fix: 2026 commits (all pass through unfiltered) With fix: 146\n>     commits (correctly filtered)\n>     \n>     [1]\n>     https://lore.kernel.org/git/CAL71e4NjDTHbKR8z7pSrPpzDrX19JOTR04sArm7P=m5ivqkskA@mail.gmail.com/T/#u\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2181%2Fspkrka%2Fkk%2Fno-walk-pathspec-fix-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2181/spkrka/kk/no-walk-pathspec-fix-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/2181\n> \n>  revision.c                |  2 +-\n>  t/t6017-rev-list-stdin.sh | 18 ++++++++++++++++++\n>  2 files changed, 19 insertions(+), 1 deletion(-)\n> \n> diff --git a/revision.c b/revision.c\n> index ccbe2e03d1..e990e3f96b 100644\n> --- a/revision.c\n> +++ b/revision.c\n> @@ -4419,6 +4419,7 @@ static struct commit *get_revision_1(struct rev_info *revs)\n>  \n>  \t\tswitch (mode) {\n>  \t\tcase REV_WALK_REFLOG:\n> +\t\tcase REV_WALK_NO_WALK:\n>  \t\t\ttry_to_simplify_commit(revs, commit);\n>  \t\t\tbreak;\n>  \t\tcase REV_WALK_TOPO:\n> @@ -4432,7 +4433,6 @@ static struct commit *get_revision_1(struct rev_info *revs)\n>  \t\t\t\t\t    oid_to_hex(&commit->object.oid));\n>  \t\t\t}\n>  \t\t\tbreak;\n> -\t\tcase REV_WALK_NO_WALK:\n>  \t\tcase REV_WALK_LIMITED:\n>  \t\t\tbreak;\n>  \t\t}\n> diff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh\n> index 4821b90e74..32284f1831 100755\n> --- a/t/t6017-rev-list-stdin.sh\n> +++ b/t/t6017-rev-list-stdin.sh\n> @@ -148,4 +148,22 @@ test_expect_success '--not via stdin does not influence revisions from command l\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success '--no-walk filters by path (single commit, match)' '\n> +\tgit rev-parse side-1 >expect &&\n> +\tgit rev-list --no-walk side-1 -- file-1 >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n> +test_expect_success '--no-walk filters by path (single commit, no match)' '\n> +\tgit rev-list --no-walk side-2 -- file-1 >actual &&\n> +\ttest_must_be_empty actual\n> +'\n> +\n> +test_expect_success '--no-walk with pathspec exclusion' '\n> +\tgit rev-parse side-3 side-2 >expect &&\n> +\tgit rev-parse side-1 side-2 side-3 >input &&\n> +\tgit rev-list --stdin --no-walk -- \":!file-1\" <input >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_done\n> \n> base-commit: d35c5399e3e54ac277bb391fc2f6be3e816d312b\n> -- \n> gitgitgadget\n> \n\n"}]}