Commit 244f8d49 authored by Michal Sojka's avatar Michal Sojka

Add (not much tested) script for pushing OSY AE to BRUTE

parents
#!/bin/bash
set -ex
handle_update() {
commit=$1
subdir=$2
declare -A trees=()
new_tree=$(git ls-tree -r -d $commit $subdir | tac | \
while read mode type hash path; do
if [ "$path" != "./" ]; then
path="./$path"
else
path="."
fi
case $path in
ae | */ae | auto_evaluation | */auto_evaluation)
upper_path="${path%/*}"
trees[$upper_path]+="$(echo -e "$mode tree $hash\t${path##*/}")"$'\n'
;;
$upper_path)
new_hash=$(echo -n "${trees[$path]}" | git mktree)
upper_path="${path%/*}"
trees[$upper_path]+="$(echo -e "040000 tree $new_hash\t${path##*/}")"$'\n'
[ $path = "./$subdir" ] && echo $new_hash
;;
esac
done)
ae=$(git rev-parse refs/heads/ae)
if git diff-tree --quiet $ae $new_tree; then return; fi
export GIT_AUTHOR_NAME="$(git log --format=%an -1 $commit)"
export GIT_AUTHOR_EMAIL="$(git log --format=%ae -1 $commit)"
new_commit=$(git commit-tree $new_tree -p $ae -m "$(git cat-file commit $commit|sed -e '0,/^$/d')")
git update-ref refs/heads/ae $commit $ae
}
while read oldrev newrev refname; do
if [ "$refname" = "refs/heads/master" ]; then
echo "Checking for AE updates"
for rev in $(git rev-list --reverse $oldrev..$newrev); do
handle_update $rev cviceni
done
echo "Pushing AE to BRUTE"
git push -f --quiet git@brutegit.felk.cvut.cz:2017z_b4b35osy/ae.git ae:master
fi
done
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