From 056938245cc654a5b5fcbe965a8040bd18c30de5 Mon Sep 17 00:00:00 2001
From: Andrzej Hajda <a.hajda@samsung.com>
Date: Tue, 18 Dec 2018 11:30:16 +0100
Subject: [PATCH] dim: use git rev-parse to get git directory

Using rev-parse git option is safer than manually parsing git files.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 dim | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/dim b/dim
index e4a4afe..e999409 100755
--- a/dim
+++ b/dim
@@ -556,13 +556,7 @@ function check_conflicts # tree
 
 function git_dir
 {
-	local dir=${1:-$PWD}
-
-	if [ -d $dir/.git ] ; then
-		echo $dir/.git
-	else
-		cut -d ' ' -f 2 < $dir/.git
-	fi
+	git -C ${1:-$PWD} rev-parse --absolute-git-dir
 }
 
 function pull_rerere_cache
-- 
GitLab