This makes "git commit" accept "-i" without any parameter (we used to barf on such a command line) to mean "commit what is in the index as-is". There is nothing surprising about this new behaviour. "git commit -i paths..." means "in addition to the changes I accumulated in the index, also run update-index on these paths and then make a commit" and this new behaviour is a natural extension to that to the case where "paths..." is empty. "git commit" without -i, -a, nor -o still behave the same way as it has done for a long time, but it now warns that this will be changed to default to the "-a" behaviour. Signed-off-by: Junio C Hamano <junkio@xxxxxxx> --- git-commit.sh | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/git-commit.sh b/git-commit.sh index 81c3a0c..6c95817 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -11,10 +11,10 @@ git-rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t branch=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD) case "$0" in -*status) +*status|*status.sh) status_only=t unmerged_ok_if_status=--unmerged ;; -*commit) +*commit|*commit.sh) status_only= unmerged_ok_if_status= ;; esac @@ -287,11 +287,15 @@ esac case "$#,$also,$only,$amend" in *,t,t,*) die "Only one of --include/--only can be used." ;; -0,t,,* | 0,,t,) - die "No paths with --include/--only does not make sense." ;; +0,t,,*) + ;; +0,,t,) + die "No paths with --only does not make sense." ;; 0,,t,t) only_include_assumed="# Clever... amending the last one with dirty index." ;; 0,,,*) + : all=t + only_include_assumed="# We will start assuming -a without -i; you have been warned." ;; *,,,*) only_include_assumed="# Explicit paths specified without -i nor -o; assuming --only paths..." @@ -304,8 +308,6 @@ t,t,*) die "Cannot use -a and -i at the same time." ;; t,,[1-9]*) die "Paths with -a does not make sense." ;; -,t,0) - die "No paths with -i does not make sense." ;; esac ################################################################ @@ -317,8 +319,8 @@ then TOP=./ fi -case "$all,$also" in -t,) +case "$all,$also,$#" in +t,,*) save_index && ( cd "$TOP" @@ -328,7 +330,7 @@ t,) git-update-index --remove -z --stdin ) ;; -,t) +,t,[1-9]*) save_index && git-ls-files --error-unmatch -- "$@" >/dev/null || exit @@ -340,7 +342,7 @@ t,) git-update-index --remove -z --stdin ) ;; -,) +,,* | ,t,0) case "$#" in 0) ;; # commit as-is @@ -407,7 +409,7 @@ GIT_INDEX_FILE="$USE_INDEX" \ # If the request is status, just show it and exit. case "$0" in -*status) +*status|*status.sh) run_status exit $? esac @@ -539,7 +541,11 @@ then echo "" echo "# Please enter the commit message for your changes." echo "# (Comment lines starting with '#' will not be included)" - test -z "$only_include_assumed" || echo "$only_include_assumed" + test -z "$only_include_assumed" || { + echo "#" + echo "$only_include_assumed" + echo "#" + } run_status } >>"$GIT_DIR"/COMMIT_EDITMSG else -- 1.4.4.1.gcee8-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html