]> git.ipfire.org Git - thirdparty/git.git/blob - t/t1408-packed-refs.sh
Merge branch 'js/range-diff-wo-dotdot'
[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-lib.sh
9
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 &&
17
18 git pack-refs --all &&
19 git for-each-ref >actual &&
20 echo "$one commit refs/heads/main" >expect &&
21 test_cmp expect actual &&
22
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 &&
29
30 git for-each-ref >actual &&
31 echo "$two commit refs/heads/main" >expect &&
32 test_cmp expect actual &&
33
34 git reflog expire --expire=now --all &&
35 git prune &&
36 git tag -m v1.0 v1.0 main
37 '
38
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
43 '
44
45 test_done