diff --git a/fugit.sh b/fugit.sh new file mode 100755 index 0000000000000000000000000000000000000000..aabbd05fedd54f230ea1a6294dc3921ba4375a38 --- /dev/null +++ b/fugit.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ $# -gt 2 ]; then + printf "Usage: %s [branch] [reponame]" $(basename $0) >&2 + printf "Default branch name will be read from comments.txt" >&2 + printf "Default reponame will be npvp-exercises" >&2 + exit 1 +fi + +if [ -z $2 ]; then + repo_name=`echo $PWD | sed 's/.*(\([a-z0-9]*\))$/\1/'` + repo_name="$repo_name/npvp-exercises" +else + repo_name=$2 +fi + +if [ -z $1 ]; then + # read branch name from comments.txt + branch_name=`cat comments.txt` + +else + branch_name=$1 +fi + +`git clone -b $branch_name git@git.imp.fu-berlin.de:$repo_name git-solution` diff --git a/fugitclean.sh b/fugitclean.sh new file mode 100755 index 0000000000000000000000000000000000000000..b567d5eb9d70e480ae6a10233619b23bbbabdc88 --- /dev/null +++ b/fugitclean.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# this script cleans all checked out repositories when called from the same folder that contains the grades.csv +# or a singular checked out repo when called from within a student folder + +find -type d \ + -wholename "*/git-solution" -prune \ + -execdir sh -c "rm -rf ./git-solution/" {} \; + diff --git a/install.sh b/install.sh index 8642ca1450c1bc3ac6f605131382095e3a38dbf5..577371715bbaee09b86eaec3c3adcf13759bcb41 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,6 @@ #! /bin/sh -scripts="fixpdf.sh fucopy.sh fufixpdf.sh fuzip.sh fuxournalexport.sh" - +scripts="fixpdf.sh fucopy.sh fufixpdf.sh fuzip.sh fuxournalexport.sh fugit.sh fugitclean.sh" destdir="${DESTDIR:=$HOME/.local/bin}" mkdir -p "$destdir"