Skip to content

Commit 9ae6be8

Browse files
author
Junio C Hamano
committed
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 <[email protected]>
1 parent 9da5c2f commit 9ae6be8

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

git-commit.sh

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,13 @@ run_status () {
8787

8888
if test -z "$initial_commit"
8989
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"
10897
committable="$?"
10998
else
11099
echo '#
@@ -155,6 +144,11 @@ run_status () {
155144
print "$_\n";
156145
}
157146
'
147+
148+
if test -n "$verbose"
149+
then
150+
git-diff-index --cached -M -p --diff-filter=MDTCRA HEAD
151+
fi
158152
case "$committable" in
159153
0)
160154
echo "nothing to commit"
@@ -578,10 +572,7 @@ else
578572
PARENTS=""
579573
fi
580574

581-
{
582-
test -z "$verbose" || echo '---'
583-
run_status
584-
} >>"$GIT_DIR"/COMMIT_EDITMSG
575+
run_status >>"$GIT_DIR"/COMMIT_EDITMSG
585576
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ]
586577
then
587578
rm -f "$GIT_DIR/COMMIT_EDITMSG"
@@ -612,11 +603,11 @@ t)
612603
esac
613604

614605
sed -e '
615-
/^---$/{
616-
s///
617-
q
618-
}
619-
/^#/d
606+
/^diff --git a\/.*/{
607+
s///
608+
q
609+
}
610+
/^#/d
620611
' "$GIT_DIR"/COMMIT_EDITMSG |
621612
git-stripspace >"$GIT_DIR"/COMMIT_MSG
622613

0 commit comments

Comments
 (0)