]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5330-no-lazy-fetch-with-commit-graph.sh
The third batch
[thirdparty/git.git] / t / t5330-no-lazy-fetch-with-commit-graph.sh
CommitLineData
3a1ea94a
HX
1#!/bin/sh
2
3test_description='test for no lazy fetch with the commit-graph'
4
b2e5d75d 5TEST_PASSES_SANITIZE_LEAK=true
3a1ea94a
HX
6. ./test-lib.sh
7
3a1ea94a
HX
8test_expect_success 'setup: prepare a repository with a commit' '
9 git init with-commit &&
10 test_commit -C with-commit the-commit &&
11 oid=$(git -C with-commit rev-parse HEAD)
12'
13
14test_expect_success 'setup: prepare a repository with commit-graph contains the commit' '
15 git init with-commit-graph &&
16 echo "$(pwd)/with-commit/.git/objects" \
17 >with-commit-graph/.git/objects/info/alternates &&
18 # create a ref that points to the commit in alternates
19 git -C with-commit-graph update-ref refs/ref_to_the_commit "$oid" &&
20 # prepare some other objects to commit-graph
21 test_commit -C with-commit-graph something &&
22 git -c gc.writeCommitGraph=true -C with-commit-graph gc &&
23 test_path_is_file with-commit-graph/.git/objects/info/commit-graph
24'
25
26test_expect_success 'setup: change the alternates to what without the commit' '
27 git init --bare without-commit &&
28 git -C with-commit-graph cat-file -e $oid &&
29 echo "$(pwd)/without-commit/objects" \
30 >with-commit-graph/.git/objects/info/alternates &&
31 test_must_fail git -C with-commit-graph cat-file -e $oid
32'
33
34test_expect_success 'fetch any commit from promisor with the usage of the commit graph' '
35 # setup promisor and prepare any commit to fetch
36 git -C with-commit-graph remote add origin "$(pwd)/with-commit" &&
37 git -C with-commit-graph config remote.origin.promisor true &&
38 git -C with-commit-graph config remote.origin.partialclonefilter blob:none &&
39 test_commit -C with-commit any-commit &&
40 anycommit=$(git -C with-commit rev-parse HEAD) &&
cb88b37c 41 GIT_TRACE="$(pwd)/trace.txt" \
3a1ea94a
HX
42 git -C with-commit-graph fetch origin $anycommit 2>err &&
43 ! grep "fatal: promisor-remote: unable to fork off fetch subprocess" err &&
44 grep "git fetch origin" trace.txt >actual &&
45 test_line_count = 1 actual
46'
47
48test_done