git-serv

All-in-one Git hosting container

git clone git://git.janzachar.dev/git-serv.git


0#!/bin/sh
1
2
3#shellcheck source=config/env
4. "/srv/config/env"
5
6usage() {
7	echo "usage: cp <old> <new>"
8	echo "  creates a copy repo"
9	echo "  example: cp foo foo2"
10	exit 1
11}
12
13[ $# -ne 2 ] && usage
14
15OLD="/repos/${1}.git"
16NEW="/repos/${2}.git"
17
18[ ! -d "$OLD" ] && {
19	echo "'${1}' does not exist!"
20	exit 1
21}
22[ -d "$NEW" ] && {
23	echo "'${2}' already exists!"
24	exit 1
25}
26
27cp -r "$OLD" "$NEW"
28
29