21 lines
356 B
Bash
21 lines
356 B
Bash
#!/bin/sh
|
|
|
|
root="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
|
|
if [ -z "$root" ]
|
|
then
|
|
builtin cd "$@"
|
|
else
|
|
if [ -z "$1" ]
|
|
then
|
|
builtin cd "$root"
|
|
else
|
|
if [ $(echo "$1" | grep '^/') ]
|
|
then builtin cd "$root"$@
|
|
else builtin cd "$@"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
git rev-parse --show-toplevel >/dev/null 2>&1 \
|
|
&& prompt gitlong || prompt normal
|