apidoc: improvements to its Git magic (#1399)

- use `--depth 1` with git-clone for faster checkout/cloning
- use `-B` with git-checkout

   > If -B is given, <new_branch> is created if it doesn’t exist;
   > otherwise, it is reset. This is the transactional equivalent of
   >
   >      $ git branch -f <branch> [<start point>]
   >      $ git checkout <branch>
This commit is contained in:
Daniel Hahler 2017-01-15 15:40:25 +01:00 committed by GitHub
parent 2c3aebc19e
commit 6b8c3642bd
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ export GIT_AUTHOR_EMAIL="awesome-robot@users.noreply.github.com"
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git clone --branch gh-pages "$REPO_APIDOC" build/apidoc \ git clone --depth 1 --branch gh-pages "$REPO_APIDOC" build/apidoc \
2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g"
cd build/apidoc cd build/apidoc
@ -50,7 +50,7 @@ else
BRANCH="gh-pages" BRANCH="gh-pages"
fi fi
if [ "$BRANCH" != "gh-pages" ]; then if [ "$BRANCH" != "gh-pages" ]; then
git checkout -b "$BRANCH" "origin/${BRANCH}" || git checkout -b "$BRANCH" git checkout -B "$BRANCH" "origin/${BRANCH}"
fi fi
# Use a temporary branch for the two commits, which allows for a better UI. # Use a temporary branch for the two commits, which allows for a better UI.