Merge branch 'ar/submodule-add-config'
[git/debian.git] / t / t1408-packed-refs.sh
blob41ba1f1d7fca94e9504e0c198b2e1f7885c41185
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-lib.sh
10 test_expect_success setup '
11 test_tick &&
12 git commit --allow-empty -m one &&
13 one=$(git rev-parse HEAD) &&
14 git for-each-ref >actual &&
15 echo "$one commit refs/heads/main" >expect &&
16 test_cmp expect actual &&
18 git pack-refs --all &&
19 git for-each-ref >actual &&
20 echo "$one commit refs/heads/main" >expect &&
21 test_cmp expect actual &&
23 git checkout --orphan another &&
24 test_tick &&
25 git commit --allow-empty -m two &&
26 two=$(git rev-parse HEAD) &&
27 git checkout -B main &&
28 git branch -D another &&
30 git for-each-ref >actual &&
31 echo "$two commit refs/heads/main" >expect &&
32 test_cmp expect actual &&
34 git reflog expire --expire=now --all &&
35 git prune &&
36 git tag -m v1.0 v1.0 main
39 test_expect_success 'no error from stale entry in packed-refs' '
40 git describe main >actual 2>&1 &&
41 echo "v1.0" >expect &&
42 test_cmp expect actual
45 test_done