2007-05-12 08:42:00 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
test_description='git add -u with path limiting
|
2007-05-12 08:42:00 +02:00
|
|
|
|
|
|
|
This test creates a working tree state with three files:
|
|
|
|
|
|
|
|
top (previously committed, modified)
|
|
|
|
dir/sub (previously committed, modified)
|
|
|
|
dir/other (untracked)
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
and issues a git add -u with path limiting on "dir" to add
|
2007-05-12 08:42:00 +02:00
|
|
|
only the updates to dir/sub.'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success 'setup' '
|
|
|
|
echo initial >top &&
|
|
|
|
mkdir dir &&
|
|
|
|
echo initial >dir/sub &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git add dir/sub top &&
|
2007-05-12 08:42:00 +02:00
|
|
|
git-commit -m initial &&
|
|
|
|
echo changed >top &&
|
|
|
|
echo changed >dir/sub &&
|
|
|
|
echo other >dir/other
|
|
|
|
'
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
test_expect_success 'update' 'git add -u dir'
|
2007-05-12 08:42:00 +02:00
|
|
|
|
|
|
|
test_expect_success 'update touched correct path' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test "`git diff-files --name-status dir/sub`" = ""'
|
2007-05-12 08:42:00 +02:00
|
|
|
|
|
|
|
test_expect_success 'update did not touch other tracked files' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test "`git diff-files --name-status top`" = "M top"'
|
2007-05-12 08:42:00 +02:00
|
|
|
|
|
|
|
test_expect_success 'update did not touch untracked files' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test "`git diff-files --name-status dir/other`" = ""'
|
2007-05-12 08:42:00 +02:00
|
|
|
|
|
|
|
test_done
|