X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-commit.sh;h=59551d99f9672233da2d8d847f9f4d535dba26de;hb=44de0da4f908b6600647673e1236b0ca504a9c15;hp=e6793bd67e42375f33b900e27f04b9af14d6f27f;hpb=4d44cb195aca5b744fd9f149af513637ff343a67;p=git.git diff --git a/git-commit.sh b/git-commit.sh index e6793bd6..59551d99 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -87,24 +87,13 @@ run_status () { if test -z "$initial_commit" then - if test -z "$verbose" - then - git-diff-index -M --cached --name-status \ - --diff-filter=MDTCRA HEAD | - sed -e ' - s/\\/\\\\/g - s/ /\\ /g - ' | - report "Updated but not checked in" "will commit" - else - if git-diff-index --cached -M -p --diff-filter=MDTCRA HEAD | - grep . - then - false - else - true - fi - fi + git-diff-index -M --cached --name-status \ + --diff-filter=MDTCRA HEAD | + sed -e ' + s/\\/\\\\/g + s/ /\\ /g + ' | + report "Updated but not checked in" "will commit" committable="$?" else echo '# @@ -155,6 +144,11 @@ run_status () { print "$_\n"; } ' + + if test -n "$verbose" + then + git-diff-index --cached -M -p --diff-filter=MDTCRA HEAD + fi case "$committable" in 0) echo "nothing to commit" @@ -578,10 +572,7 @@ else PARENTS="" fi -{ - test -z "$verbose" || echo '---' - run_status -} >>"$GIT_DIR"/COMMIT_EDITMSG +run_status >>"$GIT_DIR"/COMMIT_EDITMSG if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ] then rm -f "$GIT_DIR/COMMIT_EDITMSG" @@ -612,11 +603,11 @@ t) esac sed -e ' - /^---$/{ - s/// - q - } - /^#/d + /^diff --git a\/.*/{ + s/// + q + } + /^#/d ' "$GIT_DIR"/COMMIT_EDITMSG | git-stripspace >"$GIT_DIR"/COMMIT_MSG @@ -647,7 +638,10 @@ else fi ret="$?" rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" -git-rerere +if test -d "$GIT_DIR/rr-cache" +then + git-rerere +fi if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0 then