diff --git a/revision.c b/revision.c index ccbe2e03d1406a..e990e3f96ba3ae 100644 --- a/revision.c +++ b/revision.c @@ -4419,6 +4419,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: @@ -4432,7 +4433,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; } diff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh index 4821b90e7479ad..32284f183176a7 100755 --- a/t/t6017-rev-list-stdin.sh +++ b/t/t6017-rev-list-stdin.sh @@ -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" actual && + test_cmp expect actual +' + test_done