aboutsummaryrefslogtreecommitdiff
path: root/git-applypatch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-04 01:11:27 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-04 17:04:44 -0700
commita567d3154ec05dd991abf50389eacc36bfc25965 (patch)
tree9df6c122ce89fbed3e1ac2ffe382252e3db58115 /git-applypatch.sh
parentc2d5036de5c2e21fb736002ae5b385ceb7c6b23b (diff)
downloadgit-a567d3154ec05dd991abf50389eacc36bfc25965.tar.gz
git-a567d3154ec05dd991abf50389eacc36bfc25965.tar.xz
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>
Diffstat (limited to 'git-applypatch.sh')
-rwxr-xr-xgit-applypatch.sh21
1 files changed, 14 insertions, 7 deletions
diff --git a/git-applypatch.sh b/git-applypatch.sh
index 9f5a45bb2..14635d9bc 100755
--- a/git-applypatch.sh
+++ b/git-applypatch.sh
@@ -29,10 +29,10 @@ INFO=$3
SIGNOFF=$4
EDIT=${VISUAL:-${EDITOR:-vi}}
-export GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' .dotest/info)"
-export GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' .dotest/info)"
-export GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' .dotest/info)"
-export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' .dotest/info)"
+export GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$INFO")"
+export GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$INFO")"
+export GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$INFO")"
+export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$INFO")"
if test '' != "$SIGNOFF"
then
@@ -54,8 +54,10 @@ then
sed -ne '/^Signed-off-by: /p' "$MSGFILE" |
tail -n 1
`
- test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" ||
- echo "$SIGNOFF" >>"$MSGFILE"
+ test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
+ test '' = "$LAST_SIGNED_OFF_BY" && echo
+ echo "$SIGNOFF"
+ } >>"$MSGFILE"
fi
fi
@@ -99,7 +101,12 @@ echo
echo Applying "'$SUBJECT'"
echo
-git-apply --index "$PATCHFILE" || exit 1
+git-apply --index "$PATCHFILE" || {
+ # Here if we know which revision the patch applies to,
+ # we create a temporary working tree and index, apply the
+ # patch, and attempt 3-way merge with the resulting tree.
+ exit 1
+}
if test -x "$GIT_DIR"/hooks/pre-applypatch
then