Guilt v0.37-rc1
[guilt.git] / regression / t-020.sh
blob2f2aa10eb1e65b2726eb615804c16134ea2018dc
1 #!/bin/bash
3 # Test the push code
6 source "$REG_DIR/scaffold"
8 function fixup_time_info
10 cmd guilt pop
11 touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
12 cmd guilt push
15 cmd setup_repo
18 # incremental push by 1
20 guilt series | while read n ; do
21 cmd guilt push
23 cmd list_files
24 done
27 # pushing when there is nothing to push
30 shouldfail guilt push
31 cmd guilt push -a
33 cmd list_files
36 # pop all
38 cmd guilt pop --all
41 # push by name (initially nothing applied)
43 guilt series | while read n ; do
44 cmd guilt push $t
46 cmd list_files
48 cmd guilt pop --all
49 done
52 # push by name (incrementally)
54 guilt series | while read n ; do
55 cmd guilt push $t
57 cmd list_files
58 done
61 # pop all
63 cmd guilt pop --all
65 npatches=`guilt series | wc -l`
66 for n in `_seq -2 $npatches`; do
67 if [ $n -gt 0 ]; then
68 cmd guilt push -n $n
69 else
70 shouldfail guilt push -n $n
73 cmd list_files
75 cmd guilt pop --all
76 done
78 cmd list_files
80 # push an empty patch with no commit message
81 cmd guilt new empty.patch
82 fixup_time_info empty.patch
83 cmd list_files
85 # Ensure we can push the empty patch even when guilt.diffstat is true.
86 cmd git config guilt.diffstat true
87 cmd guilt refresh
88 fixup_time_info empty.patch
89 cmd list_files
90 cmd git config guilt.diffstat false
92 # Let the patch have a commit message, but no data.
93 cat > .git/patches/master/empty.patch <<EOF
94 Fix a bug.
96 From: Per Cederqvist <ceder@lysator.liu.se>
98 This commit fixes a serious bug.
100 FIXME:
101 - add a test case
102 - track down the bug
103 - actually fix it
106 fixup_time_info empty.patch
107 cmd list_files
109 # And once more, with an empty diffstat.
111 cmd git config guilt.diffstat true
112 cmd guilt refresh
113 fixup_time_info empty.patch
114 cmd list_files
116 # Restore the diffstat setting and remove the empty patch.
117 cmd git config guilt.diffstat false
118 cmd guilt refresh
119 fixup_time_info empty.patch
120 cmd list_files
121 # (Cannot delete an applied patch)
122 shouldfail guilt delete empty.patch
123 cmd guilt pop -a
124 cmd guilt delete -f empty.patch
125 cmd list_files
127 # FIXME:
128 # --all
129 # -a
130 # -n with some patches already applied