We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62aa91f commit 584e028Copy full SHA for 584e028
bin/git-root
@@ -6,7 +6,13 @@ git_root() {
6
7
# get the relative path of current path according to root of repo
8
git_root_relative() {
9
- git rev-parse --show-prefix
+ rel=$(git rev-parse --show-prefix)
10
+ if [ -z "$rel" ]; then
11
+ # git rev-parse --show-prefix will output empty string when we are in the root dir
12
+ echo "."
13
+ else
14
+ echo "$rel"
15
+ fi
16
}
17
18
if test $# -eq 0; then
0 commit comments