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