[maintainer-tools PATCH v2 4/4] dim: use git rev-parse to get git directory

Andrzej Hajda a.hajda at samsung.com
Tue Dec 18 10:30:16 UTC 2018


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

Signed-off-by: Andrzej Hajda <a.hajda at samsung.com>
---
 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
-- 
2.17.1



More information about the dri-devel mailing list