]> git.ipfire.org Git - thirdparty/git.git/blame - applypatch
Add quotes around the subject line that we print out as being applied.
[thirdparty/git.git] / applypatch
CommitLineData
853916ff
LT
1#!/bin/sh
2##
3## applypatch takes four file arguments, and uses those to
4## apply the unpacked patch (surprise surprise) that they
5## represent to the current tree.
6##
7## The arguments are:
8## $1 - file with commit message
9## $2 - file with the actual patch
10## $3 - file with list of filenames the patch touches
11## $4 - "info" file with Author, email and subject
12##
13MSGFILE=$1
14PATCHFILE=$2
15FILES=$3
16INFO=$4
17export AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' .dotest/info)"
18export AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' .dotest/info)"
19export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' .dotest/info)"
20
21echo
61096819 22echo Applying "'$SUBJECT'"
853916ff
LT
23echo
24
25(echo "[PATCH] $SUBJECT" ; echo ; cat $MSGFILE ) > .dotest/final-commit
26
27check-files $(cat $FILES) || exit 1
28patch -u --no-backup-if-mismatch -f -p1 --fuzz=0 --input=$PATCHFILE || exit 1
29update-cache --add --remove $(cat $FILES) || exit 1
30tree=$(write-tree) || exit 1
31echo Wrote tree $tree
32commit=$(commit-tree $tree -p $(cat .git/HEAD) < .dotest/final-commit) || exit 1
33echo Committed: $commit
34echo $commit > .git/HEAD
35