Patchwork [2/3] dim: auto-add remotes

login
register
mail settings
Submitter Daniel Vetter
Date Sept. 27, 2017, 9:48 a.m.
Message ID <20170927094850.22484-2-daniel.vetter@ffwll.ch>
Download mbox | patch
Permalink /patch/9973649/
State New
Headers show

Comments

Daniel Vetter - Sept. 27, 2017, 9:48 a.m.
Well, bother to at least prompt. Prep work for adding drm-amd.git.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 dim | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Rodrigo Vivi - Sept. 27, 2017, 3:48 p.m.
On Wed, Sep 27, 2017 at 09:48:49AM +0000, Daniel Vetter wrote:
> Well, bother to at least prompt. Prep work for adding drm-amd.git.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  dim | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/dim b/dim
> index 4d75c7a7fb0e..6ebbad2b6dfd 100755
> --- a/dim
> +++ b/dim
> @@ -274,7 +274,14 @@ function url_to_remote # url
>  			echoerr "Please set it up using:"
>  			echoerr "    $ git remote add <name> $url"

I think these 2 messages above doesn't make sense anymore, right?

>  			echoerr "with a name of your choice."
> -			return 1

\o/
I like to see more automation on the setup...

> +			remote=${url%.git}
> +			remote=${remote##*/}
> +			read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true

I'd be more in favor of forcing a standard and be flexible on .dimrc to any later change if people
really need that.

Anyways not blocking.
With messages above checked:

Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +			if [[ "$REPLY" == "" ]] ; then
> +				exit 1
> +			fi
> +
> +			git remote add $remote $url
>  		fi
>  	fi
>  
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch

diff --git a/dim b/dim
index 4d75c7a7fb0e..6ebbad2b6dfd 100755
--- a/dim
+++ b/dim
@@ -274,7 +274,14 @@  function url_to_remote # url
 			echoerr "Please set it up using:"
 			echoerr "    $ git remote add <name> $url"
 			echoerr "with a name of your choice."
-			return 1
+			remote=${url%.git}
+			remote=${remote##*/}
+			read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
+			if [[ "$REPLY" == "" ]] ; then
+				exit 1
+			fi
+
+			git remote add $remote $url
 		fi
 	fi