Skip to contentSkip to conversation

git-commit: allow -e option anywhere on command line

PATCH In review Jeff King 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 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.

---
 git-commit.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
git-commit.sh +3 -1
index 6dd04fd..4bb16db 100755
@@ -199,6 +199,7 @@ only=
 logfile=
 use_commit=
 amend=
+edit_flag=
 no_edit=
 log_given=
 log_message=
@@ -246,7 +247,7 @@ do
       shift
       ;;
   -e|--e|--ed|--edi|--edit)
-      no_edit=
+      edit_flag=t
       shift
       ;;
   -i|--i|--in|--inc|--incl|--inclu|--includ|--include)
@@ -384,6 +385,7 @@ do
       ;;
   esac
 done
+case "$edit_flag" in t) no_edit= ;; esac 
 
 ################################################################
 # Sanity check options
Signature · 1 line
1.4.1.rc1.gf603-dirty