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}
|
2017-12-10 01:07:57 +03:00
|
|
|
GIT_MAN_REF=${3?master}
|
2011-11-08 22:17:40 +04:00
|
|
|
|
2017-12-10 01:07:57 +03:00
|
|
|
GIT_DIR=
|
2011-11-08 22:17:40 +04:00
|
|
|
for d in "$repository/.git" "$repository"
|
|
|
|
do
|
2017-12-10 01:07:57 +03:00
|
|
|
if GIT_DIR="$d" git rev-parse "$GIT_MAN_REF" >/dev/null 2>&1
|
2011-11-08 22:17:40 +04:00
|
|
|
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
|
|
|
|
|
2017-12-10 01:07:57 +03:00
|
|
|
git read-tree "$GIT_MAN_REF"
|
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
|
2017-12-10 01:07:57 +03:00
|
|
|
git ls-tree -r --name-only "$GIT_MAN_REF" |
|
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"
|