[PATCH] dim: allow setup to work with different usernames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If your username on fd.o differs from your local username, you'll run
into issues while setting up dim.

Let's use regexp to filter remotes so it doesn't fail.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
---
 dim | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dim b/dim
index 89378033f472..a812320581c2 100755
--- a/dim
+++ b/dim
@@ -228,21 +228,22 @@ function url_to_remote # url
 {
 	local url remote
 
-	url="$1"
+	url=$1
+	login_url=$(echo $url | sed -e 's,ssh://,ssh://[a-zA-Z0-9]+@?,')
 
 	if [[ -z "$url" ]]; then
 		echoerr "$0 without url"
 		return 1
 	fi
 
-	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
+	remote=$(git remote -v | grep -m 1 -E "$login_url" | cut -f 1)
 
 	if [[ -z "$remote" ]]; then
-		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)
+		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's,ssh://[a-zA-Z0-9]+@?,git://,')
+		remote=$(git remote -v | grep -m 1 -E "$git_url" | cut -f 1)
 
 		if [[ -z "$remote" ]]; then
-			echoerr "No git remote for url $url or $git_url found in $(pwd)"
+			echoerr "No git remote for url $url, $login_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."
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux