@@ -102,6 +102,14 @@ assert () {
102
102
fi
103
103
}
104
104
105
+ # Usage: die_incompatible_opt OPTION COMMAND
106
+ die_incompatible_opt () {
107
+ assert test " $# " = 2
108
+ opt=" $1 "
109
+ arg_command=" $2 "
110
+ die " The '$opt ' flag does not make sense with 'git subtree $arg_command '."
111
+ }
112
+
105
113
main () {
106
114
if test $# -eq 0
107
115
then
@@ -176,16 +184,16 @@ main () {
176
184
arg_debug=1
177
185
;;
178
186
--annotate)
179
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
187
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
180
188
arg_split_annotate=" $1 "
181
189
shift
182
190
;;
183
191
--no-annotate)
184
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
192
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
185
193
arg_split_annotate=
186
194
;;
187
195
-b)
188
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
196
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
189
197
arg_split_branch=" $1 "
190
198
shift
191
199
;;
@@ -194,42 +202,42 @@ main () {
194
202
shift
195
203
;;
196
204
-m)
197
- test -n " $allow_addmerge " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
205
+ test -n " $allow_addmerge " || die_incompatible_opt " $opt " " $arg_command "
198
206
arg_addmerge_message=" $1 "
199
207
shift
200
208
;;
201
209
--no-prefix)
202
210
arg_prefix=
203
211
;;
204
212
--onto)
205
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
213
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
206
214
arg_split_onto=" $1 "
207
215
shift
208
216
;;
209
217
--no-onto)
210
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
218
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
211
219
arg_split_onto=
212
220
;;
213
221
--rejoin)
214
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
222
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
215
223
;;
216
224
--no-rejoin)
217
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
225
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
218
226
;;
219
227
--ignore-joins)
220
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
228
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
221
229
arg_split_ignore_joins=1
222
230
;;
223
231
--no-ignore-joins)
224
- test -n " $allow_split " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
232
+ test -n " $allow_split " || die_incompatible_opt " $opt " " $arg_command "
225
233
arg_split_ignore_joins=
226
234
;;
227
235
--squash)
228
- test -n " $allow_addmerge " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
236
+ test -n " $allow_addmerge " || die_incompatible_opt " $opt " " $arg_command "
229
237
arg_addmerge_squash=1
230
238
;;
231
239
--no-squash)
232
- test -n " $allow_addmerge " || die " The ' $opt ' flag does not make sense with 'git subtree $arg_command '. "
240
+ test -n " $allow_addmerge " || die_incompatible_opt " $opt " " $arg_command "
233
241
arg_addmerge_squash=
234
242
;;
235
243
--)
0 commit comments