Commit 199107cb authored by Michal Sojka's avatar Michal Sojka

Allow configuring what to sync with BRUTE

parent c2cc5de9
......@@ -2,15 +2,21 @@
# git post-receive hook to update BRUTE automatic evaluation (AE) git
# repository. After pushing to a course git repository, this script
# creates a subset of that repository containing only files for AE
# (directories */ae | */auto_evaluation) and pushes this subset to
# BRUTE's AE git repository.
# creates a subset of that repository containing only files for AE (by
# default directories */ae | */auto_evaluation) and pushes this subset
# to BRUTE's AE git repository.
#
# For the script to work, you have to manually configure brutegit
# remote in the (server) repository, where this hook is installed,
# e.g.:
#
# git remote add brutegit git@brutegit.felk.cvut.cz:2017z_b4b35osy/ae.git
#
# Optionally, you can configure what to sync to BRUTE by:
#
# git config brutegit.glob '*/ae'
# git config --add brutegit.glob '*/auto_eval'
# etc.
set -e
......@@ -19,6 +25,9 @@ set -e
# continues and produces empty tree, which is bad
set -o pipefail
glob=$(git config --get-all brutegit.glob| paste -s -d '|')
if [ -z "$glob" ]; then glob='*/ae | */auto_evaluation'; fi
handle_commit() {
commit=$1
declare -A trees=()
......@@ -28,7 +37,7 @@ handle_commit() {
( while read mode type hash path; do
path="./$path"
case "$path" in
*/ae | */auto_evaluation)
$glob)
upper_path="${path%/*}"
trees[$upper_path]+="$(echo -e "$mode tree $hash\t${path##*/}")"$'\n'
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment