Aufgaben-Python/courses/git/15_git_hooks_und_automatisierte_checks/aufgabe.sh

23 lines
891 B
Bash
Executable file

#!/usr/bin/env bash
# ==============================================================================
# 🔀 Git Hooks & CI - Git 15: Pre-Commit Hooks & Automatisierung
# ==============================================================================
# 🎯 TEILZIEL 1: Pre-Commit Hook in .git/hooks/pre-commit anlegen und ausführbar machen
# 🎯 TEILZIEL 2: Skript zur Syntax- und Passwortprüfung implementieren
# 🎯 TEILZIEL 3: Commit mit Syntaxfehler abfangen (Hook bricht mit Exit-Code 1 ab)
# 🎯 TEILZIEL 4: Validen Commit erfolgreich durchlaufen lassen
setup_pre_commit_hook() {
local repo_dir="${1:-.}"
cd "$repo_dir" || return 1
# TODO: Implementiere die geforderten Git-Befehle
echo "Führe setup_pre_commit_hook in $repo_dir aus..."
return 1
}
# Direkter Aufruf bei Skript-Ausführung
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
setup_pre_commit_hook "$@"
fi