3 test_description='index file specific tests'
7 test_expect_success 'setup' '
11 test_expect_success 'bogus GIT_INDEX_VERSION issues warning' '
14 GIT_INDEX_VERSION=2bogus &&
15 export GIT_INDEX_VERSION &&
16 git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
17 sed -e "s/ Z$/ /" <<-\EOF >expect.err &&
18 warning: GIT_INDEX_VERSION set, but the value is invalid.
21 test_i18ncmp expect.err actual.err
25 test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' '
28 GIT_INDEX_VERSION=1 &&
29 export GIT_INDEX_VERSION &&
30 git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
31 sed -e "s/ Z$/ /" <<-\EOF >expect.err &&
32 warning: GIT_INDEX_VERSION set, but the value is invalid.
35 test_i18ncmp expect.err actual.err
39 test_expect_success 'no warning with bogus GIT_INDEX_VERSION and existing index' '
41 GIT_INDEX_VERSION=1 &&
42 export GIT_INDEX_VERSION &&
43 git add a 2>actual.err &&
44 test_must_be_empty actual.err
48 test_expect_success 'out of bounds index.version issues warning' '
50 sane_unset GIT_INDEX_VERSION &&
52 git config --add index.version 1 &&
53 git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
54 sed -e "s/ Z$/ /" <<-\EOF >expect.err &&
55 warning: index.version set, but the value is invalid.
58 test_i18ncmp expect.err actual.err
62 test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
65 GIT_INDEX_VERSION=4 &&
66 export GIT_INDEX_VERSION &&
67 git config --add index.version 2 &&
70 test-tool index-version <.git/index >actual &&
71 test_cmp expect actual