Merge branch 'jc/bigfile'
[git/jnareb-git.git] / t / t3703-add-magic-pathspec.sh
blobe508246c0c904ec01775040d9fb0cc32b4b33dc2
1 #!/bin/sh
3 test_description='magic pathspec tests using git-add'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 mkdir sub anothersub &&
9 : >sub/foo &&
10 : >anothersub/foo
13 test_expect_success 'add :/' "
14 cat >expected <<-EOF &&
15 add 'anothersub/foo'
16 add 'expected'
17 add 'sub/actual'
18 add 'sub/foo'
19 EOF
20 (cd sub && git add -n :/ >actual) &&
21 test_cmp expected sub/actual
24 cat >expected <<EOF
25 add 'anothersub/foo'
26 EOF
28 test_expect_success 'add :/anothersub' '
29 (cd sub && git add -n :/anothersub >actual) &&
30 test_cmp expected sub/actual
33 test_expect_success 'add :/non-existent' '
34 (cd sub && test_must_fail git add -n :/non-existent)
37 cat >expected <<EOF
38 add 'sub/foo'
39 EOF
41 test_expect_success 'a file with the same (long) magic name exists' '
42 : >":(icase)ha" &&
43 test_must_fail git add -n ":(icase)ha" &&
44 git add -n "./:(icase)ha"
47 if mkdir ":" 2>/dev/null
48 then
49 test_set_prereq COLON_DIR
52 test_expect_success COLON_DIR 'a file with the same (short) magic name exists' '
53 : >":/bar" &&
54 test_must_fail git add -n :/bar &&
55 git add -n "./:/bar"
58 test_done