mirror of
https://github.com/NinjaTrappeur/my-repo-pins.git
synced 2024-06-02 03:24:09 +02:00
Félix Baylac-Jacqué
a768efebba
git clone is creating a destination empty directory before even attempting to clone the remote URL. It means that if the user-supplied remote URL happen to be invalid, an empty directory is getting created at dest, preventing us to try cloning the same repository once again. We fixed that issue by checking whether the remote git repository exists using git ls-remote **before** calling git clone. git ls-remote will fail on a git repository not containing any git commit. We add a function to the test bed creating a git repo with one commit. It's a bit hacky, but that's the best setup I could come with. We embed a dummy git repo to the my-repo-pins codebase and copy it during the test phase to a tmp workspace.
25 lines
602 B
Bash
Executable file
25 lines
602 B
Bash
Executable file
#!/nix/store/y0g1mvsr6vygr61f9znljik9kl0x0inc-bash-5.1-p16/bin/bash
|
|
#
|
|
# An example hook script to make use of push options.
|
|
# The example simply echoes all push options that start with 'echoback='
|
|
# and rejects all pushes when the "reject" push option is used.
|
|
#
|
|
# To enable this hook, rename this file to "pre-receive".
|
|
|
|
if test -n "$GIT_PUSH_OPTION_COUNT"
|
|
then
|
|
i=0
|
|
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
|
do
|
|
eval "value=\$GIT_PUSH_OPTION_$i"
|
|
case "$value" in
|
|
echoback=*)
|
|
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
|
;;
|
|
reject)
|
|
exit 1
|
|
esac
|
|
i=$((i + 1))
|
|
done
|
|
fi
|