Merge branch 'ps/connectivity-optim'

The revision traversal API has been optimized by taking advantage
of the commit-graph, when available, to determine if a commit is
reachable from any of the existing refs.

* ps/connectivity-optim:
  revision: avoid hitting packfiles when commits are in commit-graph
  commit-graph: split out function to search commit position
  revision: stop retrieving reference twice
  connected: do not sort input revisions
  revision: separate walk and unsorted flags
This commit is contained in:
Junio C Hamano
2021-09-03 13:49:27 -07:00
9 changed files with 129 additions and 48 deletions

View File

@ -169,4 +169,35 @@ test_expect_success 'rev-list --count --objects' '
test_line_count = $count actual
'
test_expect_success 'rev-list --unsorted-input results in different sorting' '
git rev-list --unsorted-input HEAD HEAD~ >first &&
git rev-list --unsorted-input HEAD~ HEAD >second &&
! test_cmp first second &&
sort first >first.sorted &&
sort second >second.sorted &&
test_cmp first.sorted second.sorted
'
test_expect_success 'rev-list --unsorted-input incompatible with --no-walk' '
cat >expect <<-EOF &&
fatal: --no-walk is incompatible with --unsorted-input
EOF
test_must_fail git rev-list --unsorted-input --no-walk HEAD 2>error &&
test_cmp expect error &&
test_must_fail git rev-list --unsorted-input --no-walk=sorted HEAD 2>error &&
test_cmp expect error &&
test_must_fail git rev-list --unsorted-input --no-walk=unsorted HEAD 2>error &&
test_cmp expect error &&
cat >expect <<-EOF &&
fatal: --unsorted-input is incompatible with --no-walk
EOF
test_must_fail git rev-list --no-walk --unsorted-input HEAD 2>error &&
test_cmp expect error &&
test_must_fail git rev-list --no-walk=sorted --unsorted-input HEAD 2>error &&
test_cmp expect error &&
test_must_fail git rev-list --no-walk=unsorted --unsorted-input HEAD 2>error &&
test_cmp expect error
'
test_done