Files
OpenNetworkLinux/docker/tools/gitroot
2019-09-27 23:01:48 +00:00

15 lines
180 B
Bash
Executable File

#!/bin/sh
if test $# -gt 0; then
dir=$(realpath $1)
else
dir=$(pwd)
fi
while test $dir != /; do
if test -d $dir/.git; then
echo $dir
break
fi
dir=${dir%/*}
done