Sync with 'maint'
[alt-git.git] / t / t5200-update-server-info.sh
blobcc51c73986c11272ca4b50a8dd32f55b66235a14
1 #!/bin/sh
3 test_description='Test git update-server-info'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup' 'test_commit file'
10 test_expect_success 'create info/refs' '
11 git update-server-info &&
12 test_path_is_file .git/info/refs
15 test_expect_success 'modify and store mtime' '
16 test-tool chmtime =0 .git/info/refs &&
17 test-tool chmtime --get .git/info/refs >a
20 test_expect_success 'info/refs is not needlessly overwritten' '
21 git update-server-info &&
22 test-tool chmtime --get .git/info/refs >b &&
23 test_cmp a b
26 test_expect_success 'info/refs can be forced to update' '
27 git update-server-info -f &&
28 test-tool chmtime --get .git/info/refs >b &&
29 ! test_cmp a b
32 test_expect_success 'info/refs updates when changes are made' '
33 test-tool chmtime =0 .git/info/refs &&
34 test-tool chmtime --get .git/info/refs >b &&
35 test_cmp a b &&
36 git update-ref refs/heads/foo HEAD &&
37 git update-server-info &&
38 test-tool chmtime --get .git/info/refs >b &&
39 ! test_cmp a b
42 test_expect_success 'midx does not create duplicate pack entries' '
43 git repack -d --write-midx &&
44 git repack -d &&
45 grep ^P .git/objects/info/packs >packs &&
46 uniq -d <packs >dups &&
47 test_must_be_empty dups
50 test_done