]>
Commit | Line | Data |
---|---|---|
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 | ## | |
13 | MSGFILE=$1 | |
14 | PATCHFILE=$2 | |
15 | FILES=$3 | |
16 | INFO=$4 | |
17 | export AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' .dotest/info)" | |
18 | export AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' .dotest/info)" | |
19 | export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' .dotest/info)" | |
20 | ||
21 | echo | |
61096819 | 22 | echo Applying "'$SUBJECT'" |
853916ff LT |
23 | echo |
24 | ||
25 | (echo "[PATCH] $SUBJECT" ; echo ; cat $MSGFILE ) > .dotest/final-commit | |
26 | ||
27 | check-files $(cat $FILES) || exit 1 | |
28 | patch -u --no-backup-if-mismatch -f -p1 --fuzz=0 --input=$PATCHFILE || exit 1 | |
29 | update-cache --add --remove $(cat $FILES) || exit 1 | |
30 | tree=$(write-tree) || exit 1 | |
31 | echo Wrote tree $tree | |
32 | commit=$(commit-tree $tree -p $(cat .git/HEAD) < .dotest/final-commit) || exit 1 | |
33 | echo Committed: $commit | |
34 | echo $commit > .git/HEAD | |
35 |