1#!/bin/sh
23
test_description='git add -u with path limiting
45
This test creates a working tree state with three files:
67
top (previously committed, modified)
8dir/sub (previously committed, modified)
9dir/other (untracked)
1011
and issues a git add -u with path limiting on "dir" to add
12only the updates to dir/sub.'
1314
. ./test-lib.sh
1516
test_expect_success 'setup' '
17echo initial >top &&
18mkdir dir &&
19echo initial >dir/sub &&
20git add dir/sub top &&
21git-commit -m initial &&
22echo changed >top &&
23echo changed >dir/sub &&
24echo other >dir/other
25'
2627
test_expect_success 'update' 'git add -u dir'
2829
test_expect_success 'update touched correct path' \
30'test "`git diff-files --name-status dir/sub`" = ""'
3132
test_expect_success 'update did not touch other tracked files' \
33'test "`git diff-files --name-status top`" = "M top"'
3435
test_expect_success 'update did not touch untracked files' \
36'test "`git diff-files --name-status dir/other`" = ""'
3738
test_done