Guilt v0.37-rc1
[guilt.git] / regression / t-062.sh
blob7656766b29e4f5fb2a5c24b45ed19e0fe181e583
1 #!/bin/bash
3 # Test that the guilt.reusebranch=true setting works.
6 source $REG_DIR/scaffold
8 remove_topic() {
9 cmd guilt pop -a
10 if git rev-parse --verify --quiet guilt/master >/dev/null; then
11 cmd git checkout guilt/master
12 else
13 cmd git checkout master
15 cmd guilt pop -a
16 cmd git branch -d $1
17 cmd rm -r .git/patches/$1
18 cmd git for-each-ref
19 cmd list_files
22 function fixup_time_info
24 touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
27 cmd setup_repo
29 cmd git config guilt.reusebranch true
31 cmd guilt push -a
32 cmd list_files
33 cmd git for-each-ref
35 for i in `seq 5`; do
36 if [ $i -ge 5 ]; then
37 shouldfail guilt pop
38 else
39 cmd guilt pop
41 cmd git for-each-ref
42 cmd guilt push
43 cmd git for-each-ref
44 cmd guilt pop
45 cmd git for-each-ref
46 done
48 # Check that "pop -a" properly pops all patches.
49 cmd guilt push -a
50 cmd git for-each-ref
51 cmd guilt pop -a
52 cmd git for-each-ref
54 # Check that pushing two patches converts the repo to now-style (since
55 # it currently has no patches applied).
56 cmd guilt push add
57 cmd git for-each-ref
59 # Check guilt branch with a few patches applied.
60 cmd guilt branch topic
61 cmd git for-each-ref
63 # Check that the topic branch is converted to new-style.
64 cmd guilt pop -a
65 cmd guilt push
66 cmd git for-each-ref
68 remove_topic topic
70 # Check guilt branch with the full patch series applied.
71 cmd guilt push -a
72 cmd guilt branch topic
73 cmd git for-each-ref
75 remove_topic topic
77 # Check guilt branch with no patches applied.
78 # This gives us a new-style checkout.
79 cmd guilt branch topic
80 cmd git for-each-ref
81 cmd list_files
83 remove_topic topic
85 # Check guilt branch in a new-style directory with all patches
86 # applied. (Strictly speaking, this test should probably move to a
87 # file devoted to testing "guilt branch".)
88 cmd guilt push -a
89 cmd guilt branch topic
90 cmd git for-each-ref
91 cmd list_files
92 cmd guilt pop -a
93 cmd git for-each-ref
95 remove_topic topic
97 # Check that "guilt new" does the right thing when no patches are
98 # applied. (Strictly speaking, this test should maybe move to
99 # t-025.sh).
101 cmd guilt new newpatch
102 cmd git for-each-ref '--format=%(refname)'
103 cmd guilt pop
104 fixup_time_info newpatch
105 cmd guilt push
106 cmd git for-each-ref
108 # Check that "guilt commit" does the right thing when committing all
109 # applied patches. (Strictly speaking, this test should maybe move to
110 # t-030.sh).
111 cmd git branch
112 cmd guilt applied
113 cmd guilt commit -a
114 cmd git for-each-ref
115 cmd git branch
117 # Check that "guilt commit" does the right thing when committing only
118 # a few of the applied patches. (Strictly speaking, this test should
119 # maybe move to t-030.sh).
120 cmd guilt push -a
121 cmd guilt applied
122 cmd git branch
123 cmd git for-each-ref
124 cmd guilt commit -n 2
125 cmd git for-each-ref
126 cmd git branch
127 cmd guilt commit -n 2
128 cmd git for-each-ref
129 cmd git branch
130 cmd guilt series