summaryrefslogtreecommitdiff
path: root/t/t2200-add-update.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t2200-add-update.sh')
-rwxr-xr-xt/t2200-add-update.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
new file mode 100755
index 0000000000..83005e70d0
--- /dev/null
+++ b/t/t2200-add-update.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='git-add -u with path limiting
+
+This test creates a working tree state with three files:
+
+ top (previously committed, modified)
+ dir/sub (previously committed, modified)
+ dir/other (untracked)
+
+and issues a git-add -u with path limiting on "dir" to add
+only the updates to dir/sub.'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+echo initial >top &&
+mkdir dir &&
+echo initial >dir/sub &&
+git-add dir/sub top &&
+git-commit -m initial &&
+echo changed >top &&
+echo changed >dir/sub &&
+echo other >dir/other
+'
+
+test_expect_success 'update' 'git-add -u dir'
+
+test_expect_success 'update touched correct path' \
+ 'test "`git-diff-files --name-status dir/sub`" = ""'
+
+test_expect_success 'update did not touch other tracked files' \
+ 'test "`git-diff-files --name-status top`" = "M top"'
+
+test_expect_success 'update did not touch untracked files' \
+ 'test "`git-diff-files --name-status dir/other`" = ""'
+
+test_done