3 test_description
='update-index with options'
7 test_expect_success basics
'
12 # need --add when adding
13 test_must_fail git update-index one &&
14 test -z "$(git ls-files)" &&
15 git update-index --add one &&
16 test zone = "z$(git ls-files)" &&
18 # update-index is atomic
20 test_must_fail git update-index one two &&
21 echo "M one" >expect &&
22 git diff-files --name-status >actual &&
23 test_cmp expect actual &&
25 git update-index --add one two three &&
26 for i in one three two; do echo $i; done >expect &&
27 git ls-files >actual &&
28 test_cmp expect actual &&
32 test_create_repo xyzzy &&
36 git commit -m "sub initial"
41 git commit -m initial &&
45 test_expect_success
'--ignore-missing --refresh' '
46 git reset --hard initial &&
48 test_must_fail git update-index --refresh &&
50 git update-index --refresh &&
52 test_must_fail git update-index --refresh &&
53 git update-index --ignore-missing --refresh
57 test_expect_success
'--unmerged --refresh' '
58 git reset --hard initial &&
59 info=$(git ls-files -s one | sed -e "s/ 0 / 1 /") &&
60 git rm --cached one &&
61 echo "$info" | git update-index --index-info &&
62 test_must_fail git update-index --refresh &&
63 git update-index --unmerged --refresh &&
65 test_must_fail git update-index --unmerged --refresh >actual &&
71 test_expect_success
'--ignore-submodules --refresh (1)' '
72 git reset --hard initial &&
74 test_must_fail git update-index --ignore-submodules --refresh
77 test_expect_success
'--ignore-submodules --refresh (2)' '
78 git reset --hard initial &&
82 git commit -m "sub second" --allow-empty
84 test_must_fail git update-index --refresh &&
85 test_must_fail git update-index --ignore-missing --refresh &&
86 git update-index --ignore-submodules --refresh