]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1408-packed-refs.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t1408-packed-refs.sh
CommitLineData
74195c69
JH
1#!/bin/sh
2
3test_description='packed-refs entries are covered by loose refs'
4
06d53148 5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
b2e5d75d 8TEST_PASSES_SANITIZE_LEAK=true
74195c69
JH
9. ./test-lib.sh
10
11test_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 &&
06d53148 16 echo "$one commit refs/heads/main" >expect &&
74195c69
JH
17 test_cmp expect actual &&
18
19 git pack-refs --all &&
20 git for-each-ref >actual &&
06d53148 21 echo "$one commit refs/heads/main" >expect &&
74195c69
JH
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) &&
06d53148 28 git checkout -B main &&
74195c69
JH
29 git branch -D another &&
30
31 git for-each-ref >actual &&
06d53148 32 echo "$two commit refs/heads/main" >expect &&
74195c69
JH
33 test_cmp expect actual &&
34
35 git reflog expire --expire=now --all &&
36 git prune &&
06d53148 37 git tag -m v1.0 v1.0 main
74195c69
JH
38'
39
40test_expect_success 'no error from stale entry in packed-refs' '
06d53148 41 git describe main >actual 2>&1 &&
74195c69
JH
42 echo "v1.0" >expect &&
43 test_cmp expect actual
44'
45
46test_done