diff --git a/fugit.sh b/fugit.sh index 69638fc9587de2f2077e843d9667dd83abbdedbe..5f56a34e2bd0a1bef8f027e0e1c55ebf1dad87b6 100755 --- a/fugit.sh +++ b/fugit.sh @@ -10,8 +10,10 @@ if [ $# -gt 2 ] || [ "$1" = "--help" ]; then exit 1 fi +current_dir=$(basename "$PWD") + if [ -z $2 ]; then - repo_name=`echo $PWD | sed 's/.*(\([a-z0-9]*\))$/\1/'` + repo_name=`echo $current_dir | sed 's/.*(\([a-z0-9]*\))$/\1/'` repo_name="$repo_name/npvp-exercises" else repo_name=$2 @@ -19,12 +21,18 @@ fi if [ -z $1 ]; then # read branch name from comments.txt - branch_name=`cat comments.txt` - + branch_name=`cat "${current_dir}_submissionText.html" | sed -e 's/<[^>]*>//g'` # remove all html tags. + echo $branch_name + else branch_name=$1 fi +if [ -z $branch_name ]; then + printf "No branch name provided via comments.txt\n" >&2 + exit 1; +fi + case ${FU_RUN:-0} in 1) run_cmd="python3 main.py" @@ -46,5 +54,5 @@ if ! [ -z $FU_ANDORRA_USER ]; then else # run locally: git clone -b $branch_name git@git.imp.fu-berlin.de:$repo_name git-solution || exit 1 - cd git-solution && `$run_cmd`; cd .. + cd git-solution && $run_cmd; cd .. fi