]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1408-packed-refs.sh
Merge branch 'ab/detox-gettext-tests'
[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
74195c69
JH
8. ./test-lib.sh
9
10test_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 &&
06d53148 15 echo "$one commit refs/heads/main" >expect &&
74195c69
JH
16 test_cmp expect actual &&
17
18 git pack-refs --all &&
19 git for-each-ref >actual &&
06d53148 20 echo "$one commit refs/heads/main" >expect &&
74195c69
JH
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) &&
06d53148 27 git checkout -B main &&
74195c69
JH
28 git branch -D another &&
29
30 git for-each-ref >actual &&
06d53148 31 echo "$two commit refs/heads/main" >expect &&
74195c69
JH
32 test_cmp expect actual &&
33
34 git reflog expire --expire=now --all &&
35 git prune &&
06d53148 36 git tag -m v1.0 v1.0 main
74195c69
JH
37'
38
39test_expect_success 'no error from stale entry in packed-refs' '
06d53148 40 git describe main >actual 2>&1 &&
74195c69
JH
41 echo "v1.0" >expect &&
42 test_cmp expect actual
43'
44
45test_done