3 test_description
='update-index with options'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success basics
'
13 # need --add when adding
14 test_must_fail git update-index one &&
15 test -z "$(git ls-files)" &&
16 git update-index --add one &&
17 test zone = "z$(git ls-files)" &&
19 # update-index is atomic
21 test_must_fail git update-index one two &&
22 echo "M one" >expect &&
23 git diff-files --name-status >actual &&
24 test_cmp expect actual &&
26 git update-index --add one two three &&
27 test_write_lines one three two >expect &&
28 git ls-files >actual &&
29 test_cmp expect actual &&
33 test_create_repo xyzzy &&
37 git commit -m "sub initial"
42 git commit -m initial &&
46 test_expect_success
'--ignore-missing --refresh' '
47 git reset --hard initial &&
49 test_must_fail git update-index --refresh &&
51 git update-index --refresh &&
53 test_must_fail git update-index --refresh &&
54 git update-index --ignore-missing --refresh
58 test_expect_success
'--unmerged --refresh' '
59 git reset --hard initial &&
60 info=$(git ls-files -s one | sed -e "s/ 0 / 1 /") &&
61 git rm --cached one &&
62 echo "$info" | git update-index --index-info &&
63 test_must_fail git update-index --refresh &&
64 git update-index --unmerged --refresh &&
66 test_must_fail git update-index --unmerged --refresh >actual &&
72 test_expect_success
'--ignore-submodules --refresh (1)' '
73 git reset --hard initial &&
75 test_must_fail git update-index --ignore-submodules --refresh
78 test_expect_success
'--ignore-submodules --refresh (2)' '
79 git reset --hard initial &&
83 git commit -m "sub second" --allow-empty
85 test_must_fail git update-index --refresh &&
86 test_must_fail git update-index --ignore-missing --refresh &&
87 git update-index --ignore-submodules --refresh