aboutsummaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-10 18:38:24 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-10 18:44:31 -0800
commit9ae6be80163669db921e6522140900da41753ed5 (patch)
tree7cdb374afedc317786daccdd4af1d7149835ab4a /git-commit.sh
parent9da5c2f0d7e99eca46ce12bfe08755b30f2bdd30 (diff)
downloadgit-9ae6be80163669db921e6522140900da41753ed5.tar.gz
git-9ae6be80163669db921e6522140900da41753ed5.tar.xz
git-commit -v: have patch at the end.
It was pointed out that otherwise more important summary information prefixed with '#' would become prone to be missed. Also instead of chopping at the first '^---$' line, stop at the first 'diff --git a/' line. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh45
1 files changed, 18 insertions, 27 deletions
diff --git a/git-commit.sh b/git-commit.sh
index e6793bd67..073ec81e1 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