2006-12-23 16:26:09 +00:00
|
|
|
#!/bin/sh
|
2011-11-08 18:17:40 +00:00
|
|
|
# This requires git-manpages and/or git-htmldocs repositories
|
2006-12-23 16:26:09 +00:00
|
|
|
|
2011-11-08 18:17:40 +00:00
|
|
|
repository=${1?repository}
|
|
|
|
destdir=${2?destination}
|
|
|
|
|
|
|
|
head=master GIT_DIR=
|
|
|
|
for d in "$repository/.git" "$repository"
|
|
|
|
do
|
|
|
|
if GIT_DIR="$d" git rev-parse refs/heads/master >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
GIT_DIR="$d"
|
|
|
|
export GIT_DIR
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$GIT_DIR"
|
|
|
|
then
|
|
|
|
echo >&2 "Neither $repository nor $repository/.git is a repository"
|
|
|
|
exit 1
|
2006-12-23 16:26:09 +00:00
|
|
|
fi
|
|
|
|
|
2011-11-08 18:17:40 +00:00
|
|
|
GIT_WORK_TREE=$(pwd)
|
|
|
|
GIT_INDEX_FILE=$(pwd)/.quick-doc.$$
|
|
|
|
export GIT_INDEX_FILE GIT_WORK_TREE
|
2006-12-23 16:26:09 +00:00
|
|
|
rm -f "$GIT_INDEX_FILE"
|
2007-08-05 06:48:27 +00:00
|
|
|
trap 'rm -f "$GIT_INDEX_FILE"' 0
|
|
|
|
|
2007-07-03 05:52:14 +00:00
|
|
|
git read-tree $head
|
2011-11-08 18:17:40 +00:00
|
|
|
git checkout-index -a -f --prefix="$destdir"/
|
2006-12-23 16:26:09 +00:00
|
|
|
|
2011-11-08 18:17:40 +00:00
|
|
|
if test -n "$GZ"
|
|
|
|
then
|
2007-08-07 04:15:15 +00:00
|
|
|
git ls-tree -r --name-only $head |
|
2011-11-08 18:17:40 +00:00
|
|
|
xargs printf "$destdir/%s\n" |
|
2007-08-07 04:15:15 +00:00
|
|
|
xargs gzip -f
|
2006-12-23 16:26:09 +00:00
|
|
|
fi
|
|
|
|
rm -f "$GIT_INDEX_FILE"
|