git-applypatch: cleanup.
- Defined variable $INFO was not used properly. - Make sure there is an empty line between the sign-off and the log message. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 4, 2005 at 01:11 UTC
a567d3154ec05dd991abf50389eacc36bfc25965
1 file changed
+14
-7
git-applypatch.sh
+14
-7
@@ -29,10 +29,10 @@ INFO=$3
29
SIGNOFF=$4
30
EDIT=${VISUAL:-${EDITOR:-vi}}
31
32
-export GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' .dotest/info)"
33
-export GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' .dotest/info)"
34
-export GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' .dotest/info)"
35
-export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' .dotest/info)"
32
+export GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$INFO")"
33
+export GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$INFO")"
34
+export GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$INFO")"
35
+export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$INFO")"
36
37
if test '' != "$SIGNOFF"
38
then
@@ -54,8 +54,10 @@ then
54
sed -ne '/^Signed-off-by: /p' "$MSGFILE" |
55
tail -n 1
56
`
57
- test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" ||
58
- echo "$SIGNOFF" >>"$MSGFILE"
57
+ test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
58
+ test '' = "$LAST_SIGNED_OFF_BY" && echo
59
+ echo "$SIGNOFF"
60
+ } >>"$MSGFILE"
61
fi
62
fi
63
@@ -99,7 +101,12 @@ echo
101
echo Applying "'$SUBJECT'"
102
echo
103
102
-git-apply --index "$PATCHFILE" || exit 1
104
+git-apply --index "$PATCHFILE" || {
105
+ # Here if we know which revision the patch applies to,
106
+ # we create a temporary working tree and index, apply the
107
+ # patch, and attempt 3-way merge with the resulting tree.
108
+ exit 1
109
+}
110
111
if test -x "$GIT_DIR"/hooks/pre-applypatch
112
then