Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ DIRS += iocBoot
UNINSTALL_DIRS += $(INSTALL_LOCATION)/opi

include $(TOP)/configure/RULES_TOP

sphinx:
$(MAKE) -C documentation html

sphinx-clean:
$(MAKE) -C documentation html clean

sphinx-commit: sphinx
touch documentation/_build/html/.nojekyll
./commit-gh.sh documentation/_build/html

.PHONY: sphinx sphinx-commit sphinx-clean
45 changes: 45 additions & 0 deletions commit-gh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh
set -e -x
# Usage: commit-gh <sub-directory>
#
# Creates a commit containing only the files in the sub-directory provided as an argument
#
# Does not disturb the working copy or index

[ -d "$1" ] || exit 1

# Commit to this branch
BRANCH=refs/heads/gh-pages

# Use the main branch description as the gh-pages commit message
MSG=`git describe --tags --always`

# Scratch space
TDIR=`mktemp -d -p $PWD`

# Automatic cleanup of scratch space
trap 'rm -rf $TDIR' INT TERM QUIT EXIT

export GIT_INDEX_FILE="$TDIR/index"


# Add listed files to a new (empty) index
find "$1" -type f -print0 | xargs -0 git update-index --add

# Write the index into the repo, get tree hash
TREE=`git write-tree --prefix="$1"`

echo "TREE $TREE"
git cat-file -p $TREE

# Create a commit with our new tree
# Reference current branch head as parent (if any)
CMT=`git commit-tree -m "$MSG" $TREE`

echo "COMMIT $CMT"
git cat-file -p $CMT

# Update the branch with the new commit tree hash
git update-ref $BRANCH $CMT

echo "Done"
Loading