]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/install-doc-quick.sh
t4034: abstract away SHA-1-specific constants
[thirdparty/git.git] / Documentation / install-doc-quick.sh
CommitLineData
6538d1ef 1#!/bin/sh
fcbebfdd 2# This requires git-manpages and/or git-htmldocs repositories
6538d1ef 3
fcbebfdd
JH
4repository=${1?repository}
5destdir=${2?destination}
65289e9d 6GIT_MAN_REF=${3?master}
fcbebfdd 7
65289e9d 8GIT_DIR=
fcbebfdd
JH
9for d in "$repository/.git" "$repository"
10do
65289e9d 11 if GIT_DIR="$d" git rev-parse "$GIT_MAN_REF" >/dev/null 2>&1
fcbebfdd
JH
12 then
13 GIT_DIR="$d"
14 export GIT_DIR
15 break
16 fi
17done
18
19if test -z "$GIT_DIR"
20then
21 echo >&2 "Neither $repository nor $repository/.git is a repository"
22 exit 1
6538d1ef
EW
23fi
24
fcbebfdd
JH
25GIT_WORK_TREE=$(pwd)
26GIT_INDEX_FILE=$(pwd)/.quick-doc.$$
27export GIT_INDEX_FILE GIT_WORK_TREE
6538d1ef 28rm -f "$GIT_INDEX_FILE"
00d8c518
JH
29trap 'rm -f "$GIT_INDEX_FILE"' 0
30
65289e9d 31git read-tree "$GIT_MAN_REF"
fcbebfdd 32git checkout-index -a -f --prefix="$destdir"/
6538d1ef 33
fcbebfdd
JH
34if test -n "$GZ"
35then
65289e9d 36 git ls-tree -r --name-only "$GIT_MAN_REF" |
fcbebfdd 37 xargs printf "$destdir/%s\n" |
87027ae4 38 xargs gzip -f
6538d1ef
EW
39fi
40rm -f "$GIT_INDEX_FILE"