[maintainer-tools PATCH v2 3/4] dim: fix update_rerere_cache

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


update_rerere_cache does not work correctly if drm-tip and $DIM_REPO are
workdirs - it cannot locate properly rr-cache. Let's use git rev-parse
to resolve rr-cache location.

Signed-off-by: Andrzej Hajda <a.hajda at samsung.com>
---
 dim | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/dim b/dim
index 3afa8b6..e4a4afe 100755
--- a/dim
+++ b/dim
@@ -554,15 +554,6 @@ function check_conflicts # tree
 	true
 }
 
-function rr_cache_dir
-{
-	if [ -d $DIM_PREFIX/drm-tip/.git/ ] ; then
-		echo $DIM_PREFIX/drm-tip/.git/rr-cache
-	else
-		echo $DIM_PREFIX/$DIM_REPO/.git/rr-cache
-	fi
-}
-
 function git_dir
 {
 	local dir=${1:-$PWD}
@@ -606,17 +597,25 @@ function pull_rerere_cache
 
 function update_rerere_cache
 {
+	local rr_cache_dir
+
 	echo -n "Updating rerere cache... "
 
 	pull_rerere_cache
 
-	if [ ! -L $(rr_cache_dir) ] ; then
-		if [ -d $(rr_cache_dir) ] ; then
-			rm -Rf $(rr_cache_dir)
+	cd $DIM_PREFIX/drm-tip/
+
+	rr_cache_dir=$(git rev-parse --git-common-dir)/rr-cache
+
+	if [ ! -L $rr_cache_dir ] ; then
+		if [ -d $rr_cache_dir ] ; then
+			rm -Rf $rr_cache_dir
 		fi
-		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $(dirname $(rr_cache_dir))
+		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $rr_cache_dir
 	fi
 
+	cd ~-
+
 	echo "Done."
 }
 
-- 
2.17.1



More information about the dri-devel mailing list