Allow multiple -m options to git-commit.
I find it very convenient to be able to supply multiple paragraphs of text on the command line with a single git-commit call. This change permits multiple -m/--message type options to be supplied to git-commit with each message being added as its own paragraph of text in the commit message. The -m option is still not permitted with -c/-C/-F nor are multiple occurrences of these options permitted. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Shawn Pearce committed
May 29, 2006 at 04:45 UTC
6891281cfa1a7c0d70ec76e80c5f87f518cdb160
1 file changed
+30
-7
git-commit.sh
+30
-7
@@ -260,20 +260,41 @@ do
260
-m|--m|--me|--mes|--mess|--messa|--messag|--message)
261
case "$#" in 1) usage ;; esac
262
shift
263
- log_given=t$log_given
264
- log_message="$1"
263
+ log_given=m$log_given
264
+ if test "$log_message" = ''
265
+ then
266
+ log_message="$1"
267
+ else
268
+ log_message="$log_message
269
+
270
+$1"
271
+ fi
272
no_edit=t
273
shift
274
;;
275
-m*)
269
- log_given=t$log_given
270
- log_message=`expr "$1" : '-m\(.*\)'`
276
+ log_given=m$log_given
277
+ if test "$log_message" = ''
278
+ then
279
+ log_message=`expr "$1" : '-m\(.*\)'`
280
+ else
281
+ log_message="$log_message
282
+
283
+`expr "$1" : '-m\(.*\)'`"
284
+ fi
285
no_edit=t
286
shift
287
;;
288
--m=*|--me=*|--mes=*|--mess=*|--messa=*|--messag=*|--message=*)
275
- log_given=t$log_given
276
- log_message=`expr "$1" : '-[^=]*=\(.*\)'`
289
+ log_given=m$log_given
290
+ if test "$log_message" = ''
291
+ then
292
+ log_message=`expr "$1" : '-[^=]*=\(.*\)'`
293
+ else
294
+ log_message="$log_message
295
+
296
+`expr "$1" : '-[^=]*=\(.*\)'`"
297
+ fi
298
no_edit=t
299
shift
300
;;
@@ -378,7 +399,9 @@ esac
399
400
case "$log_given" in
401
tt*)
381
- die "Only one of -c/-C/-F/-m can be used." ;;
402
+ die "Only one of -c/-C/-F can be used." ;;
403
+*tm*|*mt*)
404
+ die "Option -m cannot be combined with -c/-C/-F." ;;
405
esac
406
407
case "$#,$also,$only,$amend" in