From patchwork Thu Jun 15 15:43:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 9789017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54C3360348 for ; Thu, 15 Jun 2017 15:44:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4681128520 for ; Thu, 15 Jun 2017 15:44:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A07728684; Thu, 15 Jun 2017 15:44:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D42728520 for ; Thu, 15 Jun 2017 15:44:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5D2C6E7B6; Thu, 15 Jun 2017 15:44:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id C03196E730; Thu, 15 Jun 2017 15:44:05 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2017 08:43:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,343,1493708400"; d="scan'208";a="114853131" Received: from unknown (HELO delly.ld.intel.com) ([10.103.239.215]) by fmsmga005.fm.intel.com with ESMTP; 15 Jun 2017 08:43:47 -0700 From: Lionel Landwerlin To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH] dim: allow setup to work with different usernames Date: Thu, 15 Jun 2017 16:43:13 +0100 Message-Id: <20170615154313.7768-1-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.11.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 $url" echoerr "with a name of your choice."