84978784fe
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 20s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 26s
unit-tests Bats test report
CI Feature / Bats tests (push) Failing after 1m25s
CI Feature / Report Summary (push) Successful in 5s
41 lines
968 B
Bash
Executable File
41 lines
968 B
Bash
Executable File
#!/usr/bin/env bash
|
|
echo "git $*" >> "${GIT_CALLS_FILE:-/dev/null}"
|
|
|
|
[ -z "${GIT_MOCK_FAIL:-}" ] || { echo "git: mock forced failure" >&2; exit 1; }
|
|
|
|
if [ "${1:-}" = "push" ] && [ -n "${GIT_MOCK_FAIL_PUSH:-}" ]; then
|
|
echo "git: mock push failure" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Skip -c config arguments
|
|
while [ "${1:-}" = "-c" ]; do
|
|
shift 2
|
|
done
|
|
|
|
case "$1" in
|
|
clone)
|
|
TARGET_DIR="${@: -1}"
|
|
mkdir -p "${TARGET_DIR}/$(dirname "$INPUT_FILE")"
|
|
echo 'version: 0.1.0' > "${TARGET_DIR}/${INPUT_FILE}"
|
|
echo "Cloning into '$TARGET_DIR'..."
|
|
;;
|
|
add|commit|push|config|init)
|
|
;;
|
|
diff)
|
|
# Default: exit 1 = has changes → proceed to commit
|
|
# GIT_MOCK_DIFF_NO_CHANGES=1 → exit 0 = no changes → "no change" path
|
|
if [ -n "${GIT_MOCK_DIFF_NO_CHANGES:-}" ]; then
|
|
exit 0
|
|
fi
|
|
exit 1
|
|
;;
|
|
rev-parse)
|
|
echo "mock-sha-9876543210fedcba9876543210fedcba98765432"
|
|
;;
|
|
*)
|
|
echo "git: unknown command: $*" >&2
|
|
exit 1
|
|
;;
|
|
esac
|