Parcourir la source

Fix case when git root is passed (as dot or .. from deeper)

In that case (i.e. , the `${full#git_root}` would not work and print the full
basically full absolute path to git root.
Alois Mahdal il y a 8 ans
Parent
révision
dd06fe56f8
1 fichiers modifiés avec 1 ajouts et 0 suppressions
  1. 1
    0
      dotfiles/gittum/bin/slurp

+ 1
- 0
dotfiles/gittum/bin/slurp Voir le fichier

@@ -41,6 +41,7 @@ git_relative() {
41 41
     local path="$1"
42 42
     test -n "$GIT_PREFIX" && path="$GIT_PREFIX/$path"
43 43
     local full=$(readlink -m "$path")
44
+    test "$full" = "$git_root" && echo . && return
44 45
     printf %s "${full#$git_root/}"
45 46
 }
46 47