Follow upstream changes -- rest
[git-darcs-import.git] / tests / bad-format.sh
blob77b1ed18131a01176d931a43e72443009538c085
1 #!/usr/bin/env bash
2 set -ev
4 ## I would use the builtin !, but that has the wrong semantics.
5 not () { "$@" && exit 1 || :; }
7 rm -rf temp1 temp2
8 mkdir temp1
9 cd temp1
10 darcs initialize --old-fashioned
11 echo A > foo
12 darcs add foo
13 darcs record -a -m AA -A x
14 echo '<UGLY HTML-LIKE GARBAGE RETURNED BY BAD HTTP SERVER>' > _darcs/format
15 cd ..
17 # ensure that we successfully get repositories even if they have a bogus
18 # format file, as can happen if no _darcs/format is present (i.e. it's
19 # generated by an older darcs) and an http server fails to produce a 404
20 # error code. This is issue757.
22 darcs get temp1 temp2
24 echo intentional-error >> temp2/_darcs/format
26 cat temp2/_darcs/format
28 rm -rf temp1
30 not darcs get temp2 temp1 2> err
32 cat err
33 grep intentional-error err
34 grep 'understand repository format' err
36 rm -rf temp1 temp2