1#!/bin/sh
2# This requires a branch named in $head
3# (usually 'man' or 'html', provided by the git.git repository)
4set -e
5head="$1"
6mandir="$2"
7SUBDIRECTORY_OK=t
8USAGE='<refname> <target directory>'
9. git-sh-setup
10export GIT_DIR
1112
test -z "$mandir" && usage
13if ! git-rev-parse --verify "$head^0" >/dev/null; then
14echo >&2 "head: $head does not exist in the current repository"
15usage
16fi
1718
GIT_INDEX_FILE=`pwd`/.quick-doc.index
19export GIT_INDEX_FILE
20rm -f "$GIT_INDEX_FILE"
21git-read-tree $head
22git-checkout-index -a -f --prefix="$mandir"/
2324
if test -n "$GZ"; then
25cd "$mandir"
26for i in `git-ls-tree -r --name-only $head`
27do
28gzip < $i > $i.gz && rm $i
29done
30fi
31rm -f "$GIT_INDEX_FILE"