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>
Junio C Hamano committed
Feb 10, 2006 at 18:38 UTC
9ae6be80163669db921e6522140900da41753ed5
1 file changed
+18
-27
git-commit.sh
+18
-27
@@ -87,24 +87,13 @@ run_status () {
87
88
if test -z "$initial_commit"
89
then
90
- if test -z "$verbose"
91
- then
92
- git-diff-index -M --cached --name-status \
93
- --diff-filter=MDTCRA HEAD |
94
- sed -e '
95
- s/\\/\\\\/g
96
- s/ /\\ /g
97
- ' |
98
- report "Updated but not checked in" "will commit"
99
- else
100
- if git-diff-index --cached -M -p --diff-filter=MDTCRA HEAD |
101
- grep .
102
- then
103
- false
104
- else
105
- true
106
- fi
107
- fi
90
+ git-diff-index -M --cached --name-status \
91
+ --diff-filter=MDTCRA HEAD |
92
+ sed -e '
93
+ s/\\/\\\\/g
94
+ s/ /\\ /g
95
+ ' |
96
+ report "Updated but not checked in" "will commit"
97
committable="$?"
98
else
99
echo '#
@@ -155,6 +144,11 @@ run_status () {
144
print "$_\n";
145
}
146
'
147
+
148
+ if test -n "$verbose"
149
+ then
150
+ git-diff-index --cached -M -p --diff-filter=MDTCRA HEAD
151
+ fi
152
case "$committable" in
153
0)
154
echo "nothing to commit"
@@ -578,10 +572,7 @@ else
572
PARENTS=""
573
fi
574
581
-{
582
- test -z "$verbose" || echo '---'
583
- run_status
584
-} >>"$GIT_DIR"/COMMIT_EDITMSG
575
+run_status >>"$GIT_DIR"/COMMIT_EDITMSG
576
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ]
577
then
578
rm -f "$GIT_DIR/COMMIT_EDITMSG"
@@ -612,11 +603,11 @@ t)
603
esac
604
605
sed -e '
615
- /^---$/{
616
- s///
617
- q
618
- }
619
- /^#/d
606
+ /^diff --git a\/.*/{
607
+ s///
608
+ q
609
+ }
610
+ /^#/d
611
' "$GIT_DIR"/COMMIT_EDITMSG |
612
git-stripspace >"$GIT_DIR"/COMMIT_MSG
613