Merge branch 'kk/no-walk-pathspec-fix'

The 'git rev-list --no-walk' command has been corrected to restore
pathspec filtering, which was lost when the streaming walk was
refactored.

* kk/no-walk-pathspec-fix:
  revision: fix --no-walk path filtering regression
This commit is contained in:
Junio C Hamano
2026-07-22 10:30:55 -07:00
2 changed files with 19 additions and 1 deletions

View File

@@ -4424,6 +4424,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
switch (mode) {
case REV_WALK_REFLOG:
case REV_WALK_NO_WALK:
try_to_simplify_commit(revs, commit);
break;
case REV_WALK_TOPO:
@@ -4437,7 +4438,6 @@ static struct commit *get_revision_1(struct rev_info *revs)
oid_to_hex(&commit->object.oid));
}
break;
case REV_WALK_NO_WALK:
case REV_WALK_LIMITED:
break;
}

View File

@@ -148,4 +148,22 @@ test_expect_success '--not via stdin does not influence revisions from command l
test_cmp expect actual
'
test_expect_success '--no-walk filters by path (single commit, match)' '
git rev-parse side-1 >expect &&
git rev-list --no-walk side-1 -- file-1 >actual &&
test_cmp expect actual
'
test_expect_success '--no-walk filters by path (single commit, no match)' '
git rev-list --no-walk side-2 -- file-1 >actual &&
test_must_be_empty actual
'
test_expect_success '--no-walk with pathspec exclusion' '
git rev-parse side-3 side-2 >expect &&
git rev-parse side-1 side-2 side-3 >input &&
git rev-list --stdin --no-walk -- ":!file-1" <input >actual &&
test_cmp expect actual
'
test_done