Skip to content

Commit 60aa81f

Browse files
committed
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
2 parents af4899f + 32c4ed7 commit 60aa81f

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4424,6 +4424,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
44244424

44254425
switch (mode) {
44264426
case REV_WALK_REFLOG:
4427+
case REV_WALK_NO_WALK:
44274428
try_to_simplify_commit(revs, commit);
44284429
break;
44294430
case REV_WALK_TOPO:
@@ -4437,7 +4438,6 @@ static struct commit *get_revision_1(struct rev_info *revs)
44374438
oid_to_hex(&commit->object.oid));
44384439
}
44394440
break;
4440-
case REV_WALK_NO_WALK:
44414441
case REV_WALK_LIMITED:
44424442
break;
44434443
}

t/t6017-rev-list-stdin.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,22 @@ test_expect_success '--not via stdin does not influence revisions from command l
148148
test_cmp expect actual
149149
'
150150

151+
test_expect_success '--no-walk filters by path (single commit, match)' '
152+
git rev-parse side-1 >expect &&
153+
git rev-list --no-walk side-1 -- file-1 >actual &&
154+
test_cmp expect actual
155+
'
156+
157+
test_expect_success '--no-walk filters by path (single commit, no match)' '
158+
git rev-list --no-walk side-2 -- file-1 >actual &&
159+
test_must_be_empty actual
160+
'
161+
162+
test_expect_success '--no-walk with pathspec exclusion' '
163+
git rev-parse side-3 side-2 >expect &&
164+
git rev-parse side-1 side-2 side-3 >input &&
165+
git rev-list --stdin --no-walk -- ":!file-1" <input >actual &&
166+
test_cmp expect actual
167+
'
168+
151169
test_done

0 commit comments

Comments
 (0)