blob: ed9dfd624c754206e58b7eaaf0c023b573d8ffc1 [file] [log] [blame]
Eric Wongf4f476b2019-05-13 23:17:08 +00001#!/bin/sh
2
3test_description='Test git update-server-info'
4
Ævar Arnfjörð Bjarmasond96fb142021-10-31 00:24:13 +02005TEST_PASSES_SANITIZE_LEAK=true
Eric Wongf4f476b2019-05-13 23:17:08 +00006. ./test-lib.sh
7
8test_expect_success 'setup' 'test_commit file'
9
10test_expect_success 'create info/refs' '
11 git update-server-info &&
12 test_path_is_file .git/info/refs
13'
14
15test_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
20test_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
26test_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
32test_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
42test_done