shithub: git9

ref: 76566d81a8e51d8d8255c9d6a8e7cd107fc6de01
dir: /common.rc/

View raw version
nl='
'

fn die{
	>[1=2] echo $0: $*
	exit $"*
}

fn usage{
	>[1=2] echo -n 'usage:' $usage
	exit 'usage'
}

fn gitup{
	gitroot=`{git/conf -r >[2]/dev/null}
	if(~ $#gitroot 0)
		die 'not a git repository'
	gitrel=`{pwd | sed 's@^'$gitroot'/*@@'}
	if(~ $#gitrel 0)
		gitrel='.'
	cd $gitroot
	startfs=()
	if(! test -e /mnt/git/ctl)
		startfs=true
	if(! grep -s '^repo '$gitroot'$' /mnt/git/ctl >[2]/dev/null)
		startfs=true
	if(~ $#startfs 1)
		git/fs
	if not
		status=''
}