2023-06-28 00:52:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
|
2023-11-08 21:56:31 +00:00
|
|
|
|
|
|
|
if [ "$#" -ne 2 ]; then
|
|
|
|
echo "invalid arguments (use -c or -d)" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = '-c' ]; then
|
|
|
|
if [ -d "$2.git" ]; then
|
|
|
|
echo "repository already exists" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -f post-receive ]; then
|
|
|
|
echo "missing post-receive script" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mkdir "$2.git" && git init --bare "$2.git" || exit 1
|
|
|
|
touch "$2.git/git-daemon-export-ok"
|
|
|
|
ln /srv/git/git-shell-commands/post-receive "$2.git/hooks/post-receive" || exit 1
|
|
|
|
echo "git://git.acid.vegas/$2.git" > "$2.git/url"
|
|
|
|
elif [ "$1" = '-d' ]; then
|
|
|
|
if [ ! -d "$2.git" ]; then
|
|
|
|
echo "repository does not exist" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
rm -rf "$2.git"
|
2023-11-05 06:50:22 +00:00
|
|
|
else
|
2023-11-08 21:56:31 +00:00
|
|
|
echo "invalid arguments (use -c or -d)" >&2
|
|
|
|
exit 1
|
2023-11-05 06:50:22 +00:00
|
|
|
fi
|