darkrc/bin/gitpath

13 lines
206 B
Text
Raw Normal View History

2020-02-04 14:48:13 +00:00
#!/bin/sh
top=$(git rev-parse --show-toplevel 2>/dev/null | sed -e 's/\//\\\//g')
if [ -n "$top" ]
then
2020-02-07 12:15:51 +00:00
path=$(pwd -P | sed -e "s/^$top//")
if [ ! -z "$path" ]
then echo -n "$path "
fi
2020-02-04 14:48:13 +00:00
else
exit 1
2020-02-04 14:48:13 +00:00
fi