3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='git update-index --again test.
12 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
0 file1
13 100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47
0 file2
15 test_expect_success
'update-index --add' '
16 echo hello world >file1 &&
17 echo goodbye people >file2 &&
18 git update-index --add file1 file2 &&
19 git ls-files -s >current &&
23 test_expect_success
'update-index --again' '
25 echo hello everybody >file2 &&
26 if git update-index --again
28 echo should have refused to remove file1
31 echo happy - failed as expected
33 git ls-files -s >current &&
38 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f
0 file2
40 test_expect_success
'update-index --remove --again' '
41 git update-index --remove --again &&
42 git ls-files -s >current &&
46 test_expect_success
'first commit' 'git commit -m initial'
49 100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979
0 dir
1/file3
50 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f
0 file2
52 test_expect_success
'update-index again' '
54 echo hello world >dir1/file3 &&
55 echo goodbye people >file2 &&
56 git update-index --add file2 dir1/file3 &&
57 echo hello everybody >file2 &&
58 echo happy >dir1/file3 &&
59 git update-index --again &&
60 git ls-files -s >current &&
65 100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f
0 dir
1/file3
66 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f
0 file2
68 test_expect_success
'update-index --update from subdir' '
69 echo not so happy >file2 &&
71 cat ../file2 >file3 &&
72 git update-index --again
74 git ls-files -s >current &&
79 100644 594fb5bb1759d90998e2bf2a38261ae8e243c760
0 dir
1/file3
80 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f
0 file2
82 test_expect_success
'update-index --update with pathspec' '
83 echo very happy >file2 &&
84 cat file2 >dir1/file3 &&
85 git update-index --again dir1/ &&
86 git ls-files -s >current &&