-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-add: allow path limiting with -u
Rather than updating all working tree paths, we limit ourselves to paths listed on the command line. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Jeff King
authored and
Junio C Hamano
committed
May 12, 2007
1 parent
16a4c61
commit 93c44d4
Showing
2 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |