]> git.ipfire.org Git - thirdparty/git.git/blob - t/t1408-packed-refs.sh
The third batch
[thirdparty/git.git] / t / t1408-packed-refs.sh
1 #!/bin/sh
2
3 test_description='packed-refs entries are covered by loose refs'
4
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 test_expect_success setup '
12 test_tick &&
13 git commit --allow-empty -m one &&
14 one=$(git rev-parse HEAD) &&
15 git for-each-ref >actual &&
16 echo "$one commit refs/heads/main" >expect &&
17 test_cmp expect actual &&
18
19 git pack-refs --all &&
20 git for-each-ref >actual &&
21 echo "$one commit refs/heads/main" >expect &&
22 test_cmp expect actual &&
23
24 git checkout --orphan another &&
25 test_tick &&
26 git commit --allow-empty -m two &&
27 two=$(git rev-parse HEAD) &&
28 git checkout -B main &&
29 git branch -D another &&
30
31 git for-each-ref >actual &&
32 echo "$two commit refs/heads/main" >expect &&
33 test_cmp expect actual &&
34
35 git reflog expire --expire=now --all &&
36 git prune &&
37 git tag -m v1.0 v1.0 main
38 '
39
40 test_expect_success 'no error from stale entry in packed-refs' '
41 git describe main >actual 2>&1 &&
42 echo "v1.0" >expect &&
43 test_cmp expect actual
44 '
45
46 test_done