git-server

git server-side stuff | stagit
git clone git://git.ckyln.com/~cem/hooks.git
Log | Files | Refs | README

commit e387801004a6e1bff8a52c3ba6ade75c063fcea7
parent ab1c533f0ecc93c226754f641785a2b6fab0c456
Author: Cem Keylan <cem@ckyln.com>
Date:   Fri, 19 Jun 2020 12:04:03 +0300

mkrepo: add script to create a repository

Diffstat:
Ascripts/mkrepo | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/scripts/mkrepo b/scripts/mkrepo @@ -0,0 +1,30 @@ +#!/bin/sh -e +# Create a repository +# +# shellcheck disable=1090 + +case "$1" in --help|-h|'') + printf '%s\n' "usage: ${0##*/} [repo] [description] [file...]" + exit 0 +esac + +# Source the configuration and library +. "${GIT_CONFDIR:?}/config" +. "$GIT_CONFDIR/lib" + +mkdir -p "$REPO_DIR/$1.git" + +cd "$REPO_DIR/$1.git" || exit 1 +git --bare init + +# Link the post-receive script to hooks +ln -sf "$GIT_CONFDIR/post-receive" hooks/post-receive + +printf '%s\n' "$2" > description + +# Create empty files such as 'archive', 'raw' so that we can make use +# of it on the post-receive hook. +[ "$3" ] && { + shift 2 + for file; do :>> "$file"; done +}