Follow upstream changes -- rest
[git-darcs-import.git] / tests / record.sh
blob93e2ec8b02943d928532c8d778e8e6b742995e36
1 #!/usr/bin/env bash
2 set -ev
4 # Some tests for 'darcs record '
6 not () { "$@" && exit 1 || :; }
8 portable_pwd () {
9 if uname | grep -i cygwin > /dev/null; then
10 cygpath -w `pwd`
11 else
12 pwd
16 rm -rf temp1
17 mkdir temp1
18 cd temp1
19 darcs init
21 # issue308 - no patches and no deps for record should abort
22 darcs record -am foo --ask-deps | grep -i "Ok, if you don't want to record anything, that's fine!"
24 # RT#476 - --ask-deps works when there are no patches
25 if echo $OS | grep -i windows; then
26 echo This test does not work on Windows
27 else
28 touch t.f
29 darcs add t.f
30 darcs record -am add
31 echo a | darcs record -am foo --ask-deps | grep -i 'finished recording'
34 # RT#231 - special message is given for nonexistent directories
35 not darcs record -am foo not_there.txt > log
36 grep -i 'non existent' log
38 # RT#231 - a nonexistent file before an existing file is handled correctly
39 touch b.t
40 darcs record -am foo a.t b.t > log
41 grep -i 'non existent files or directories: "a.t"' log
43 # record works with absolute paths
44 # hack for Cygwin and portable_pwd
45 IFS=''
46 DIR=`portable_pwd`
47 touch date.t
48 darcs add date.t
49 darcs record -a -m foo ${DIR}/date.t | grep -i 'finished recording'
51 # issue396 - record -l ""
52 touch 'notnull.t'
53 darcs record -am foo -l "" notnull.t | grep -i 'finished recording'
55 # basic record
56 date >> date.t
57 darcs record -a -m basic_record date.t | grep -i 'finished recording'
59 # testing --logfile
60 date >> date.t
61 echo "second record\n" >> log.txt
62 darcs record -a -m 'second record' --logfile=log.txt date.t | grep -i 'finished recording'
64 cd ..
65 rm -rf temp1