3 test_description
='git add -u with path limiting
5 This test creates a working tree state with three files:
7 top (previously committed, modified)
8 dir/sub (previously committed, modified)
11 and issues a git add -u with path limiting on "dir" to add
12 only the updates to dir/sub.'
16 test_expect_success setup
'
17 echo initial >check &&
21 echo initial >dir1/sub1 &&
22 echo initial >dir1/sub2 &&
23 echo initial >dir2/sub3 &&
24 git add check dir1 dir2 top foo &&
26 git-commit -m initial &&
28 echo changed >check &&
30 echo changed >dir2/sub3 &&
32 echo other >dir2/other
35 test_expect_success update
'
39 test_expect_success
'update noticed a removal' '
40 test "$(git-ls-files dir1/sub1)" = ""
43 test_expect_success
'update touched correct path' '
44 test "$(git-diff-files --name-status dir2/sub3)" = ""
47 test_expect_success
'update did not touch other tracked files' '
48 test "$(git-diff-files --name-status check)" = "M check" &&
49 test "$(git-diff-files --name-status top)" = "M top"
52 test_expect_success
'update did not touch untracked files' '
53 test "$(git-ls-files dir2/other)" = ""
56 test_expect_success
'cache tree has not been corrupted' '
59 sed -e "s/ 0 / /" >expect &&
60 git ls-tree -r $(git write-tree) |
61 sed -e "s/ blob / /" >current &&
62 diff -u expect current
66 test_expect_success
'update from a subdirectory' '
74 test_expect_success
'change gets noticed' '
76 test "$(git diff-files --name-status dir1)" = ""
80 test_expect_success
'replace a file with a symlink' '