From 18da8a85c85cfccf7f0bb24105a41b205b903f2f Mon Sep 17 00:00:00 2001
From: Markus M <mmi.github@gmail.com>
Date: Tue, 30 Apr 2024 13:17:53 +0200
Subject: [PATCH] switched input file for getting branch to
 ${basename}_submissionText.html

---
 fugit.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fugit.sh b/fugit.sh
index 69638fc..5f56a34 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
-- 
GitLab