git-server

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

mkrepo (638B)


      1 #!/bin/sh -e
      2 # Create a repository
      3 #
      4 # shellcheck disable=1090
      5 
      6 case "$1" in --help|-h|'')
      7     printf '%s\n' "usage: ${0##*/} [repo] [description] [file...]"
      8     exit 0
      9 esac
     10 
     11 # Source the configuration and library
     12 . "${GIT_CONFDIR:?}/config"
     13 . "$GIT_CONFDIR/lib"
     14 
     15 mkdir -p "$REPO_DIR/$1.git"
     16 
     17 cd "$REPO_DIR/$1.git" || exit 1
     18 git --bare init
     19 
     20 # Link the post-receive script to hooks
     21 ln -sf "$GIT_CONFDIR/post-receive" hooks/post-receive
     22 
     23 printf '%s\n' "$2" > description
     24 
     25 # Create empty files such as 'archive', 'raw' so that we can make use
     26 # of it on the post-receive hook.
     27 [ "$3" ] && {
     28     shift 2
     29     for file; do :>> "$file"; done
     30 }