Skip to content

Commit cda8ab5

Browse files
peffJunio C Hamano
authored and
Junio C Hamano
committed
git-commit: allow -e option anywhere on command line
Previously, the command 'git-commit -e -m foo' would ignore the '-e' option because the '-m' option overwrites the no_edit flag during sequential option parsing. Now we cause -e to reset the no_edit flag after all options are parsed. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8d3cbd2 commit cda8ab5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-commit.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ only=
199199
logfile=
200200
use_commit=
201201
amend=
202+
edit_flag=
202203
no_edit=
203204
log_given=
204205
log_message=
@@ -246,7 +247,7 @@ do
246247
shift
247248
;;
248249
-e|--e|--ed|--edi|--edit)
249-
no_edit=
250+
edit_flag=t
250251
shift
251252
;;
252253
-i|--i|--in|--inc|--incl|--inclu|--includ|--include)
@@ -384,6 +385,7 @@ $1"
384385
;;
385386
esac
386387
done
388+
case "$edit_flag" in t) no_edit= ;; esac
387389

388390
################################################################
389391
# Sanity check options

0 commit comments

Comments
 (0)