summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorPaolo Bonzini <paolo.bonzini@lu.unisi.ch>2007-03-05 08:57:53 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-09 00:05:23 -0800
commit6cbf07efc5702351897dee4742525c9b9f7828ac (patch)
tree4ed450733ea20be3cdeb98922bf589db65b950de /git-commit.sh
parentbd1fc628b8d456bdaea3e10d435cf1e98bc5d8a8 (diff)
downloadgit-6cbf07efc5702351897dee4742525c9b9f7828ac.tar.gz
git-commit: add a --interactive option
The --interactive option behaves like "git commit", except that "git add --interactive" is executed before committing. It is incompatible with -a and -i. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/git-commit.sh b/git-commit.sh
index b8c00b8236..3656d607d5 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2005 Linus Torvalds
# Copyright (c) 2006 Junio C Hamano
-USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'
+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
@@ -71,6 +71,7 @@ trap '
all=
also=
+interactive=
only=
logfile=
use_commit=
@@ -131,6 +132,11 @@ do
also=t
shift
;;
+ --int|--inte|--inter|--intera|--interac|--interact|--interacti|\
+ --interactiv|--interactive)
+ interactive=t
+ shift
+ ;;
-o|--o|--on|--onl|--only)
only=t
shift
@@ -304,12 +310,14 @@ case "$#,$also,$only,$amend" in
;;
esac
unset only
-case "$all,$also,$#" in
-t,t,*)
- die "Cannot use -a and -i at the same time." ;;
+case "$all,$interactive,$also,$#" in
+*t,*t,*)
+ die "Cannot use -a, --interactive or -i at the same time." ;;
t,,[1-9]*)
die "Paths with -a does not make sense." ;;
-,t,0)
+,t,[1-9]*)
+ die "Paths with --interactive does not make sense." ;;
+,,t,0)
die "No paths with -i does not make sense." ;;
esac
@@ -344,6 +352,9 @@ t,)
) || exit
;;
,)
+ if test "$interactive" = t; then
+ git add --interactive || exit
+ fi
case "$#" in
0)
;; # commit as-is