diff mbox series

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

Message ID 20181218103016.8070-5-a.hajda@samsung.com (mailing list archive)
State New, archived
Headers show
Series dim: fix git directory evaluation | expand

Commit Message

Andrzej Hajda Dec. 18, 2018, 10:30 a.m. UTC
Using rev-parse git option is safer than manually parsing git files.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 dim | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

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