]>
Commit | Line | Data |
---|---|---|
f4f476b6 EW |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test git update-server-info' | |
4 | ||
d96fb140 | 5 | TEST_PASSES_SANITIZE_LEAK=true |
f4f476b6 EW |
6 | . ./test-lib.sh |
7 | ||
8 | test_expect_success 'setup' 'test_commit file' | |
9 | ||
10 | test_expect_success 'create info/refs' ' | |
11 | git update-server-info && | |
12 | test_path_is_file .git/info/refs | |
13 | ' | |
14 | ||
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 | |
18 | ' | |
19 | ||
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 | |
24 | ' | |
25 | ||
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 | |
30 | ' | |
31 | ||
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 | |
40 | ' | |
41 | ||
42 | test_done |