diff mbox

[3/6] dim: Also allow git urls

Message ID 20170126091049.9122-3-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Jan. 26, 2017, 9:10 a.m. UTC
Maybe there's only a read-only remote available, and with the
drm-misc/-intel split that's perfectly fine.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Jani Nikula Jan. 26, 2017, 10:39 a.m. UTC | #1
On Thu, 26 Jan 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Maybe there's only a read-only remote available, and with the
> drm-misc/-intel split that's perfectly fine.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  dim | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/dim b/dim
> index e5afa9ee1bb8..cf61dc412652 100755
> --- a/dim
> +++ b/dim
> @@ -218,11 +218,16 @@ function url_to_remote # url
>  	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
>  
>  	if [[ -z "$remote" ]]; then
> -		echoerr "No git remote for url $url found in $(pwd)"
> -		echoerr "Please set it up using:"
> -		echoerr "    $ git remote add <name> $url"
> -		echoerr "with a name of your choice."
> -		return 1
> +		git_url=`echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/'`

I've thought about fixing this in the past, and I'm sure you know the
above is far from being universally true. It may be a quick fix for fdo,
but quite the hack.

In fact, *all* drm-tip repos in nightly.conf could be written as git
urls, and we could rebuild drm-tip from them. There is no longer a need
to have any of them ssh:// urls.

BR,
Jani.


> +		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
> +
> +		if [[ -z "$remote" ]]; then
> +			echoerr "No git remote for url $url or $git_url found in $(pwd)"
> +			echoerr "Please set it up using:"
> +			echoerr "    $ git remote add <name> $url"
> +			echoerr "with a name of your choice."
> +			return 1
> +		fi
>  	fi
>  
>  	echo $remote
diff mbox

Patch

diff --git a/dim b/dim
index e5afa9ee1bb8..cf61dc412652 100755
--- a/dim
+++ b/dim
@@ -218,11 +218,16 @@  function url_to_remote # url
 	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
 
 	if [[ -z "$remote" ]]; then
-		echoerr "No git remote for url $url found in $(pwd)"
-		echoerr "Please set it up using:"
-		echoerr "    $ git remote add <name> $url"
-		echoerr "with a name of your choice."
-		return 1
+		git_url=`echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/'`
+		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
+
+		if [[ -z "$remote" ]]; then
+			echoerr "No git remote for url $url or $git_url found in $(pwd)"
+			echoerr "Please set it up using:"
+			echoerr "    $ git remote add <name> $url"
+			echoerr "with a name of your choice."
+			return 1
+		fi
 	fi
 
 	echo $remote