Git 2.45
[git/gitster.git] / t / t1408-packed-refs.sh
blob9469c79a585f051177a4c9223c0e0f9fd37124dd
1 #!/bin/sh
3 test_description='packed-refs entries are covered by loose refs'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
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 &&
19 git pack-refs --all &&
20 git for-each-ref >actual &&
21 echo "$one commit refs/heads/main" >expect &&
22 test_cmp expect actual &&
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 &&
31 git for-each-ref >actual &&
32 echo "$two commit refs/heads/main" >expect &&
33 test_cmp expect actual &&
35 git reflog expire --expire=now --all &&
36 git prune &&
37 git tag -m v1.0 v1.0 main
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
46 test_done