diff --git a/webhooks-git/programm-hook.sh b/webhooks-git/programm-hook.sh index e4ab640..212890b 100644 --- a/webhooks-git/programm-hook.sh +++ b/webhooks-git/programm-hook.sh @@ -6,8 +6,8 @@ if [ "$#" -ne 2 ]; then exit 1 fi -repository_name="$1" -branch_name=(basename "$2") +repository_name="$2" +branch_name=$(basename "$1") BRANCHES_FOLDER="/html/branches" PROGRAMM_REPOSITORY="git_programm:AG-Programm/parteiprogramm.git" diff --git a/webhooks-git/programm-init.sh b/webhooks-git/programm-init.sh index ca207be..e3d6fc6 100644 --- a/webhooks-git/programm-init.sh +++ b/webhooks-git/programm-init.sh @@ -29,13 +29,14 @@ done # # Fetch all branch names # -git ls-remote --heads "$PROGRAMM_REPOSITORY" | - # Extract branch names - awk '{print $2}' | - # Remove "refs/heads/" prefix to get only branch names - sed 's#refs/heads/##' | - # Store branch names in an array - mapfile -t branches +branches=() +while read -r ref; do + # Extract branch name from the reference + branch_name=$(echo "$ref" | awk '{print $2}' | sed 's/refs\/heads\///') + + # put into array + branches+=("$branch_name") +done < <(git ls-remote --heads "$PROGRAMM_REPOSITORY") for branch in "${branches[@]}"; do