[PATCH 4/4] dim: automatically clone maintainer-tools repo

Lucas De Marchi lucas.demarchi at intel.com
Mon Mar 4 20:27:38 UTC 2019


Do like it's done for other repo instead of just complain.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 dim | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dim b/dim
index bada79c..1d3854b 100755
--- a/dim
+++ b/dim
@@ -76,8 +76,6 @@ dim=$(basename $0)
 dim_today=$(date +%Y-%m-%d)
 dim_timestamp="$(date --utc +%Yy-%mm-%dd-%Hh-%Mm-%Ss) UTC"
 
-maintainer_tools_https=https://gitlab.freedesktop.org/drm/maintainer-tools.git
-
 # Recipients for all dim based pull requests.
 # Add To: lines to the end, Cc: lines in the beginning with -c.
 dim_pull_request_recipients=(
@@ -2218,10 +2216,11 @@ function setup_aux_checkout # name url directory
 
 function dim_setup
 {
-	local remote drm_tip_ssh linux_upstream_git
+	local remote drm_tip_ssh linux_upstream_git maintainer_tools_https
 
 	drm_tip_ssh=ssh://git.freedesktop.org/git/drm-tip
 	linux_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+	maintainer_tools_https=https://gitlab.freedesktop.org/drm/maintainer-tools.git
 
 	if [[ ! -d "$DIM_PREFIX" ]]; then
 		if ask_user "The DIM_PREFIX repository directory '$DIM_PREFIX' doesn't exist. Create?"; then
@@ -2251,9 +2250,14 @@ function dim_setup
 		exit 1
 	fi
 
-	if [[ ! -d "$(git_dir maintainer-tools)" ]]; then
-		echoerr "No maintainer-tools git checkout found in 'maintainer-tools'."
-		echoerr "dim update will not work. Please fix."
+	if [[ ! -d "$(git_dir maintainer-tools 2>/dev/null)" ]]; then
+		if ask_user "The maintainer-tools repository doesn't exist. Clone it?"; then
+			git clone "$maintainer_tools_https" "maintainer-tools"
+		fi
+		if [[ ! -d "$(git_dir maintainer-tools)" ]]; then
+			echoerr "No maintainer-tools git checkout found in 'maintainer-tools'."
+			echoerr "dim update will not work. Please fix."
+		fi
 	fi
 
 	setup_aux_checkout rerere-cache $drm_tip_ssh drm-rerere
-- 
2.20.1



More information about the dim-tools mailing list