瀏覽代碼

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 8 年之前
父節點
當前提交
dd06fe56f8
共有 1 個檔案被更改,包括 1 行新增0 行删除
  1. 1
    0
      dotfiles/gittum/bin/slurp

+ 1
- 0
dotfiles/gittum/bin/slurp 查看文件

@@ -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