[PATCH] dim: Specify maintainer-tools branch name

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Fri Nov 9 01:27:30 UTC 2018


When using worktree, the src repo might already have a master branch,
which would make dim setup fail. Use a different name to avoid
clashes. dim_update_branches is also expecting the branch to be
called maintainer-tools.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
---
 dim | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/dim b/dim
index 3d6548568b56..78d69a5bd864 100755
--- a/dim
+++ b/dim
@@ -2082,25 +2082,31 @@ function dim_status
 	done
 }
 
-function setup_aux_checkout # name url directory
+function setup_aux_checkout # name url directory [branch]
 {
-	local name url dir remote
+	local name url dir remote branch
 
 	name=$1
 	url=$2
 	dir=$3
 
+	if [[ $# -eq 4 ]]; then
+		branch=$4
+	else
+		branch=$name
+	fi
+
 	echo "Setting up $dir ..."
 
 	if [ ! -d $dir ]; then
 		if git help worktree &> /dev/null ; then
 			cd $DIM_PREFIX/$DIM_REPO
 			remote=$(url_to_remote $url)
-			if ! git_branch_exists $name ; then
+			if ! git_branch_exists $branch ; then
 				git_fetch_helper $remote
-				git branch --track $name $remote/$name
+				git branch --track $branch $remote/$name
 			fi
-			git worktree add $DIM_PREFIX/$dir $name
+			git worktree add $DIM_PREFIX/$dir $branch
 		else
 			git clone --reference=$DIM_PREFIX/$DIM_REPO/.git $url $dir
 			cd $dir
@@ -2113,8 +2119,8 @@ function setup_aux_checkout # name url directory
 		cd $dir
 		remote=$(url_to_remote $url)
 	fi
-	if ! git_branch_exists $name ; then
-		git checkout -t $remote/$name
+	if ! git_branch_exists $branch ; then
+		git checkout $branch -t $remote/$name
 	fi
 	cd - > /dev/null
 }
@@ -2146,7 +2152,7 @@ function dim_setup
 
 	cd $DIM_PREFIX
 
-	setup_aux_checkout master $maintainer_tools_https maintainer-tools
+	setup_aux_checkout master $maintainer_tools_https maintainer-tools maintainer-tools
 
 	setup_aux_checkout rerere-cache $drm_tip_ssh drm-rerere
 
-- 
2.19.1



More information about the dim-tools mailing list