Follow upstream changes -- Bytestring updates
[git-darcs-import.git] / tests / lazy-optimize-reorder.sh
blob1d6b794a9cc55f197842cf406bf74c7ff2dd6454
1 #!/usr/bin/env bash
3 set -ev
4 not () { "$@" && exit 1 || :; }
6 rm -rf temp1 temp2 temp3
7 mkdir temp1
8 cd temp1
9 darcs init
11 # this test only applies to hashed formats
12 if cat _darcs/inventory; then exit 0; fi
14 date > f1
15 darcs add f1
16 darcs record -am 'add f1'
18 darcs tag -m 'tag f1'
20 date > f2
21 darcs add f2
22 darcs record -am 'add f2'
23 cd ..
25 darcs get --lazy temp1 temp2
27 darcs get --lazy temp2 temp3
29 cd temp2
31 # Run darcs changes so we pull in the inventories (but no the patches)
32 darcs changes
34 # Remove original repository, so we have no references to changes f1 and f2.
35 rm -rf ../temp1
37 # Now we should be unable to read some of the history
38 darcs changes -s > out
39 cat out
40 grep unavailable out
42 date > f3
43 darcs add f3
44 darcs record -am 'add f3'
46 darcs tag -m 'tag 123'
47 cd ..
49 cd temp3
50 date > f4
51 darcs add f4
52 darcs record -am 'add f4'
53 darcs pull -av
55 # Here's the point of this test: we should be able to optimize
56 # --reorder without being able to read all the patches in the
57 # repository.
58 darcs optimize --reorder
60 # Just a double-check: we shouldn't be able to check in this case.
61 not darcs check
63 cd ..
65 rm -rf temp1 temp2 temp3 temp4