2 # Copyright (c) 2006 Karl Hasselström
3 test_description='Test the delete command (deleting one patch at a time).'
7 'Initialize the StGIT repository' \
20 'Try to delete a non-existing patch' \
22 [ $(stg applied | wc -l) -eq 1 ] &&
24 [ $(stg applied | wc -l) -eq 1 ]
28 'Try to delete the topmost patch while dirty' \
30 echo dirty >> foo.txt &&
31 [ $(stg applied | wc -l) -eq 1 ] &&
33 [ $(stg applied | wc -l) -eq 1 ] &&
38 'Delete the topmost patch' \
40 [ $(stg applied | wc -l) -eq 1 ] &&
42 [ $(stg applied | wc -l) -eq 0 ]
46 'Create an unapplied patch' \
56 'Delete an unapplied patch' \
58 [ $(stg unapplied | wc -l) -eq 1 ] &&
60 [ $(stg unapplied | wc -l) -eq 0 ]
64 'Create two patches' \
77 'Try to delete a non-topmost applied patch' \
79 [ $(stg applied | wc -l) -eq 2 ] &&
81 [ $(stg applied | wc -l) -eq 2 ]
85 'Hide the topmost patch and try to delete it' \
87 [ $(stg applied | wc -l) -eq 2 ] &&
90 [ $(stg applied | wc -l) -eq 1 ]
94 'Create another branch, and put one patch in each branch' \
96 stg branch --create br &&
102 stg new baz -m baz &&
103 echo baz > baz.txt &&
108 test_expect_success \
109 'Delete a patch in another branch' \
111 [ $(stg applied | wc -l) -eq 2 ] &&
112 [ $(stg applied -b br | wc -l) -eq 1 ] &&
113 stg delete -b br baz &&
114 [ $(stg applied | wc -l) -eq 2 ] &&
115 [ $(stg applied -b br | wc -l) -eq 0 ]