shithub: git9

ref: 1e8a5c690d21a1b6fc3ff78b116541bb139c761f
dir: /init/

View raw version
#!/bin/rc -e
rfork ne
. /sys/lib/git/common.rc

flagfmt='b:bare, u:upstream upstream'; args='name'
eval `''{aux/getflags $*} || exec aux/usage

~ $bare 1 && sub='' || sub='/.git'

if(~ $#* 0)
	dir=.
if not if(~ $#* 1)
	dir=$1
if not
	exec aux/usage

if(test -e $dir$sub)
	die $dir$sub already exists

mkdir -p $dir$sub
dircp /sys/lib/git/template $dir/$sub
mkdir -p $dir/$sub/refs/heads
mkdir -p $dir/$sub/refs/remotes
>>$dir/$sub/config {
	if(! ~ $#upstream 0){
		echo '[remote "origin"]'
		echo '	url='$upstream
	}
	echo '[branch "master"]'
	echo '	remote = origin'
	echo '	merge = refs/heads/master' 
}
exit ''