git_dir function returns git directory for current working directory.
Allowing specifying any directory allows to reuse it more widely.

Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
---
 dim | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 70939ff..df66c58 100755
--- a/dim
+++ b/dim
@@ -565,10 +565,12 @@ function rr_cache_dir
 
 function git_dir
 {
-       if [ -d $PWD/.git ] ; then
-               echo $PWD/.git
+       local dir=${1:-$PWD}
+
+       if [ -d $dir/.git ] ; then
+               echo $dir/.git
        else
-               cut -d ' ' -f 2 < $PWD/.git
+               cut -d ' ' -f 2 < $dir/.git
        fi
 }
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to