equal
deleted
inserted
replaced
|
1 #!/bin/bash |
|
2 |
|
3 set -e |
|
4 |
|
5 require_clean_work_tree() { |
|
6 # test if working tree is dirty |
|
7 git rev-parse --verify HEAD > /dev/null && |
|
8 git update-index --refresh && |
|
9 git diff-files --quiet && |
|
10 git diff-index --cached --quiet HEAD || |
|
11 die "Working tree is dirty" |
|
12 } |
|
13 |
|
14 branch=master |
|
15 |
|
16 if [ $# = 1 ]; then |
|
17 repo=$1 |
|
18 elif [ $# = 2 ]; then |
|
19 repo=$1 |
|
20 branch=$2 |
|
21 else |
|
22 echo "usage: $0 <path to local harfbuzz repository> [branch]" |
|
23 exit 1 |
|
24 fi |
|
25 |
|
26 if [ ! -r $repo/.git ]; then |
|
27 echo "The provided path $repo does not point to a git repository." |
|
28 exit 2 |
|
29 fi |
|
30 |
|
31 test -z "$(git rev-parse --show-cdup)" || { |
|
32 exit=$? |
|
33 echo >&2 "You need to run this command from the toplevel of the working tree." |
|
34 exit $exit |
|
35 } |
|
36 |
|
37 require_clean_work_tree |
|
38 |
|
39 url=`git --git-dir=$repo/.git config remote.origin.url` |
|
40 |
|
41 git ls-files src/3rdparty/harfbuzz | git update-index --force-remove --stdin |
|
42 |
|
43 git fetch $repo $branch |
|
44 |
|
45 commit=`git rev-parse FETCH_HEAD` |
|
46 tree=`git cat-file commit FETCH_HEAD|grep "^tree" | awk '{print $2}'` |
|
47 |
|
48 git read-tree --prefix=src/3rdparty/harfbuzz $tree |
|
49 |
|
50 git checkout src/3rdparty/harfbuzz |
|
51 |
|
52 git status |
|
53 |
|
54 cat >commitlog.txt <<EOT |
|
55 Updated Harfbuzz from $url to $commit |
|
56 EOT |
|
57 |
|
58 echo |
|
59 echo "Wrote commitlog.txt. Use with" |
|
60 echo |
|
61 echo " git commit -e -F commitlog.txt" |
|
62 echo |
|
63 echo "to commit your changes" |