X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-commit.sh;h=04aad5e5da6fad46bc71c859286615c2f6ce11ab;hb=e27e609bbf81271318d99f2643f378f3fde6c6c6;hp=81c3a0cb6152b02ccdcaed607efcd500813ce607;hpb=82cc8d839bbfd3d13f308145bdae4c9622de57e2;p=git.git diff --git a/git-commit.sh b/git-commit.sh index 81c3a0cb6..04aad5e5d 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -8,7 +8,6 @@ SUBDIRECTORY_OK=Yes . git-sh-setup 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) @@ -80,6 +79,7 @@ no_edit= log_given= log_message= verify=t +quiet= verbose= signoff= force_author= @@ -241,6 +241,10 @@ $1" signoff=t shift ;; + -q|--q|--qu|--qui|--quie|--quiet) + quiet=t + shift + ;; -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t shift @@ -350,19 +354,9 @@ t,) refuse_partial "Cannot do a partial commit during a merge." fi TMP_INDEX="$GIT_DIR/tmp-index$$" - if test -z "$initial_commit" - then - # make sure index is clean at the specified paths, or - # they are additions. - dirty_in_index=`git-diff-index --cached --name-status \ - --diff-filter=DMTU HEAD -- "$@"` - test -z "$dirty_in_index" || - refuse_partial "Different in index and the last commit: -$dirty_in_index" - fi commit_only=`git-ls-files --error-unmatch -- "$@"` || exit - # Build the temporary index and update the real index + # Build a temporary index and update the real index # the same way. if test -z "$initial_commit" then @@ -525,7 +519,7 @@ then current="$(git-rev-parse --verify HEAD)" else if [ -z "$(git-ls-files)" ]; then - echo >&2 Nothing to commit + echo >&2 'nothing to commit (use "git add file1 file2" to include for commit)' exit 1 fi PARENTS="" @@ -625,8 +619,17 @@ then git-rerere fi -if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0 +if test "$ret" = 0 then - "$GIT_DIR"/hooks/post-commit + if test -x "$GIT_DIR"/hooks/post-commit + then + "$GIT_DIR"/hooks/post-commit + fi + if test -z "$quiet" + then + echo "Created${initial_commit:+ initial} commit $commit" + git-diff-tree --shortstat --summary --root --no-commit-id HEAD + fi fi + exit "$ret"