Documentation / install-doc-quick.shon commit t1512: skip test if not using SHA-1 (d7a2fc8)
   1#!/bin/sh
   2# This requires git-manpages and/or git-htmldocs repositories
   3
   4repository=${1?repository}
   5destdir=${2?destination}
   6GIT_MAN_REF=${3?master}
   7
   8GIT_DIR=
   9for d in "$repository/.git" "$repository"
  10do
  11        if GIT_DIR="$d" git rev-parse "$GIT_MAN_REF" >/dev/null 2>&1
  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
  23fi
  24
  25GIT_WORK_TREE=$(pwd)
  26GIT_INDEX_FILE=$(pwd)/.quick-doc.$$
  27export GIT_INDEX_FILE GIT_WORK_TREE
  28rm -f "$GIT_INDEX_FILE"
  29trap 'rm -f "$GIT_INDEX_FILE"' 0
  30
  31git read-tree "$GIT_MAN_REF"
  32git checkout-index -a -f --prefix="$destdir"/
  33
  34if test -n "$GZ"
  35then
  36        git ls-tree -r --name-only "$GIT_MAN_REF" |
  37        xargs printf "$destdir/%s\n" |
  38        xargs gzip -f
  39fi
  40rm -f "$GIT_INDEX_FILE"