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