4 # Some tests for 'darcs add'
6 not
() { "$@" && exit 1 ||
:; }
10 # set up the repository
15 # Make sure that messages about directories call them directories
20 not darcs add foo.d
2> log
22 # Try adding the same directory when it's already in the repo
23 not darcs add foo.d oof.d
2> log
24 grep -i directories log
26 # Make sure that messages about files call them files
31 not darcs add bar
2> log
32 grep -i 'following file is' log
33 not darcs add bar baz
2> log
34 grep -i 'following files are' log
36 # Make sure that messages about both files and directories say so
37 not darcs add bar foo.d
2> log
38 grep -i 'files and directories' log
40 # Make sure that parent directories are added for files
41 mkdir
-p a.d
/aa.d
/aaa.d
43 touch a.d
/aa.d
/aaa.d
/baz
44 touch a.d
/aa.d
/aaa.d
/bar
45 darcs add a.d
/aa.d
/aaa.d
/bar a.d
/aa.d
/aaa.d
/baz b.d
/bb.d
2> log
46 test ! -s log
# no output
48 # Make sure that darcs doesn\'t complains about duplicate adds when adding parent dirs.
51 darcs add c.d
/baz c.d
2> log
52 test ! -s log
# no output
54 # Make sure that add output looks good when adding files in subdir
57 darcs add
-rv d.d |
grep 'd.d/foo'
59 # 'adding a non-existent dir and file gives the expected message
60 not darcs add notadir
/notafile
2> log
61 grep -i 'does not exist' log