darkrc/bin/gitpath

13 lines
203 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
path=$(pwd | 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