Files
simplegit/hook.sh
T

17 lines
450 B
Bash
Executable File

#!/bin/sh
# Default standalone policy: append the hook invocation and its stdin to a log.
# Integrations can supply another script with simplegit daemon -hook-script.
log_file=${SIMPLEGIT_HOOK_LOG:-${SIMPLEGIT_REPO_ROOT%/repos}/hooks.log}
{
printf '%s\t%s\t%s' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$1" "$2"
shift 2
for arg in "$@"; do
printf '\t%s' "$arg"
done
printf '\n'
sed 's/^/stdin\t/'
} >>"$log_file" 2>/dev/null || true
exit 0