2006-12-23 19:26:09 +03:00
|
|
|
#!/bin/sh
|
2011-11-08 22:17:40 +04:00
|
|
|
# This requires git-manpages and/or git-htmldocs repositories
|
2006-12-23 19:26:09 +03:00
|
|
|
|
2011-11-08 22:17:40 +04: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 19:26:09 +03:00
|
|
|
fi
|
|
|
|
|
2011-11-08 22:17:40 +04:00
|
|
|
GIT_WORK_TREE=$(pwd)
|
|
|
|
GIT_INDEX_FILE=$(pwd)/.quick-doc.$$
|
|
|
|
export GIT_INDEX_FILE GIT_WORK_TREE
|
2006-12-23 19:26:09 +03:00
|
|
|
rm -f "$GIT_INDEX_FILE"
|
2007-08-05 10:48:27 +04:00
|
|
|
trap 'rm -f "$GIT_INDEX_FILE"' 0
|
|
|
|
|
2007-07-03 09:52:14 +04:00
|
|
|
git read-tree $head
|
2011-11-08 22:17:40 +04:00
|
|
|
git checkout-index -a -f --prefix="$destdir"/
|
2006-12-23 19:26:09 +03:00
|
|
|
|
2011-11-08 22:17:40 +04:00
|
|
|
if test -n "$GZ"
|
|
|
|
then
|
2007-08-07 08:15:15 +04:00
|
|
|
git ls-tree -r --name-only $head |
|
2011-11-08 22:17:40 +04:00
|
|
|
xargs printf "$destdir/%s\n" |
|
2007-08-07 08:15:15 +04:00
|
|
|
xargs gzip -f
|
2006-12-23 19:26:09 +03:00
|
|
|
fi
|
|
|
|
rm -f "$GIT_INDEX_FILE"
|