#!/bin/bashset -erequire_clean_work_tree() { # test if working tree is dirty git rev-parse --verify HEAD > /dev/null && git update-index --refresh && git diff-files --quiet && git diff-index --cached --quiet HEAD || die "Working tree is dirty"}branch=masterif [ $# = 1 ]; then repo=$1elif [ $# = 2 ]; then repo=$1 branch=$2else echo "usage: $0 <path to local harfbuzz repository> [branch]" exit 1fiif [ ! -r $repo/.git ]; then echo "The provided path $repo does not point to a git repository." exit 2fitest -z "$(git rev-parse --show-cdup)" || { exit=$? echo >&2 "You need to run this command from the toplevel of the working tree." exit $exit}require_clean_work_treeurl=`git --git-dir=$repo/.git config remote.origin.url`git ls-files src/3rdparty/harfbuzz | git update-index --force-remove --stdingit fetch $repo $branchcommit=`git rev-parse FETCH_HEAD`tree=`git cat-file commit FETCH_HEAD|grep "^tree" | awk '{print $2}'`git read-tree --prefix=src/3rdparty/harfbuzz $treegit checkout src/3rdparty/harfbuzzgit statuscat >commitlog.txt <<EOTUpdated Harfbuzz from $url to $commitEOTechoecho "Wrote commitlog.txt. Use with"echoecho " git commit -e -F commitlog.txt"echoecho "to commit your changes"