[PATCH 1/2] dim: extract pull_rerere_cache

Daniel Vetter daniel.vetter at ffwll.ch
Fri Dec 15 15:34:49 UTC 2017


Just prep for the next patch.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/dim b/dim
index 094127e3ce90..ab58ceedc7aa 100755
--- a/dim
+++ b/dim
@@ -508,11 +508,14 @@ function rr_cache_dir
 	fi
 }
 
-function update_rerere_cache
+function pull_rerere_cache
 {
-	echo -n "Updating rerere cache... "
-
 	cd $DIM_PREFIX/drm-rerere/
+	if ! git_is_current_branch rerere-cache; then
+		echo "Fail: Branch setup for the rerere-cache is borked."
+		exit 1
+	fi
+
 	if ! git pull -q ; then
 		echoerr "Failed to update the rerere cache."
 		echoerr "Please manually run"
@@ -521,6 +524,15 @@ function update_rerere_cache
 
 		return 1
 	fi
+	cd - > /dev/null
+}
+
+function update_rerere_cache
+{
+	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)
@@ -528,8 +540,6 @@ function update_rerere_cache
 		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $(dirname $(rr_cache_dir))
 	fi
 
-	cd - > /dev/null
-
 	echo "Done."
 }
 
@@ -537,24 +547,13 @@ function commit_rerere_cache
 {
 	local remote file commit_message
 
-	echo -n "Updating rerere cache... "
+	echo -n "Finalizing rerere cache... "
 
 	cd $DIM_PREFIX/drm-rerere/
-	if ! git_is_current_branch rerere-cache; then
-		echo "Fail: Branch setup for the rerere-cache is borked."
-		exit 1
-	fi
-
 	remote=$(branch_to_remote rerere-cache)
 
-	if ! git pull -q; then
-		echoerr "Failed to update the rerere cache."
-		echoerr "Please manually run"
-		echoerr "	$ cd $DIM_PREFIX/drm-rerere; git pull"
-		echoerr "and fixup any issues."
+	pull_rerere_cache
 
-		return 1
-	fi
 	git add ./*.patch >& /dev/null || true
 	git add fixups/*.patch >& /dev/null || true
 	for file  in $(git ls-files -- rr-cache); do
-- 
2.15.1



More information about the dim-tools mailing list