5c9df73a66
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 34s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 45s
unit-tests Bats test report
CI Feature / Bats tests (push) Successful in 1m36s
CI Feature / Report Summary (push) Successful in 5s
35 lines
872 B
Bash
Executable File
35 lines
872 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
|
|
|
|
case "$1" in
|
|
clone)
|
|
TARGET_DIR="${@: -1}"
|
|
mkdir -p "$TARGET_DIR"
|
|
cd "$TARGET_DIR"
|
|
git init --initial-branch=main 2>/dev/null
|
|
git config user.email "mock@test.com"
|
|
git config user.name "Mock Test"
|
|
mkdir -p "$(dirname "$INPUT_FILE")"
|
|
echo 'version: 0.1.0' > "$INPUT_FILE"
|
|
git add -A 2>/dev/null
|
|
git commit -m "initial" 2>/dev/null
|
|
echo "Cloning into '$TARGET_DIR'..."
|
|
;;
|
|
add|commit|push|config|init)
|
|
;;
|
|
rev-parse)
|
|
echo "mock-sha-9876543210fedcba9876543210fedcba98765432"
|
|
;;
|
|
*)
|
|
echo "git: unknown command: $*" >&2
|
|
exit 1
|
|
;;
|
|
esac
|