summaryrefslogtreecommitdiff
path: root/mkrepo
blob: b184d82d4066751edeb8e39a22760338eef584b6 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Make a new repo.

declare -a extra_git_args

if [ "$1" = "--sha256" ]; then
	extra_git_args+=( --object-format=sha256 )
	shift
fi

if [ $# -ne 1 ]; then
	echo "Syntax: $0 [--sha256] <name>" >&2
	exit 1
fi

if [[ $1 == *..* ]]; then
	echo "No .." >&2
	exit 1
fi
if [[ $1 == */* ]]; then
	echo "No /" >&2
	exit 1
fi


git init --shared --bare "${extra_git_args[@]}" "$HOME/$1.git"
git -C "$HOME/$1.git" config --unset receive.denyNonFastForwards

echo "Created $USER@$(hostname -f):$1.git"