From patchwork Fri Aug 25 11:31:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9921825 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 2855D6022E for ; Fri, 25 Aug 2017 11:32:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 141A826D08 for ; Fri, 25 Aug 2017 11:32:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 085FD27F54; Fri, 25 Aug 2017 11:32:35 +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=ham 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 512E926D08 for ; Fri, 25 Aug 2017 11:32:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C8CF6E844; Fri, 25 Aug 2017 11:32:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B0166E844 for ; Fri, 25 Aug 2017 11:32:31 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170825113228euoutp01d6c7930da43f5b7db1b8bb9697d51c87~eE3v1IxNn3163131631euoutp01Q; Fri, 25 Aug 2017 11:32:28 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170825113227eucas1p22f17891f3fcb94fb466f1fc8a40c55e4~eE3vGMyTf0583405834eucas1p2B; Fri, 25 Aug 2017 11:32:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 1B.64.12944.BCA00A95; Fri, 25 Aug 2017 12:32:27 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1~eE3udt63C2909729097eucas1p2c; Fri, 25 Aug 2017 11:32:27 +0000 (GMT) X-AuditID: cbfec7f4-f79ab6d000003290-60-59a00acbd031 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F7.32.20118.BCA00A95; Fri, 25 Aug 2017 12:32:27 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OV8003KKO22K060@eusync3.samsung.com>; Fri, 25 Aug 2017 12:32:27 +0100 (BST) From: Andrzej Hajda To: dri-devel@lists.freedesktop.org Subject: [maintainer-tools PATCH] dim: fix remote repository lookup function Date: Fri, 25 Aug 2017 13:31:55 +0200 Message-id: <1503660715-24287-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djPc7qnuRZEGpyfpmFxa905VouNM9az Wix8eJfZ4srX92wWe+68ZrRYe+QuuwObx95vC1g8Fu95yeRxv/s4k0ffllWMASxRXDYpqTmZ ZalF+nYJXBmnj7az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P4ONZRFQlWhq msYOYvMKOEvsf3KBCWKdnMTNc53MExi5FzAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAgM xm3Hfm7Zwdj1LvgQowAHoxIP740r8yKFWBPLiitzDzFKcDArifD+4VwQKcSbklhZlVqUH19U mpNafIjRFGj5RGYp0eR8YKTklcQbmhiaWxoaGVtYmBsZKYnzql9uihQSSE8sSc1OTS1ILYLp Y+LglGpg5Jf4mnQppux389wDRys26d+9EsKR/Feg/fvdNq2gYxusUnXuFy3Zk3vMsVG3PSqX K7f1/4L9ZfvjQycoT/nJz8Fp37pBMl3BWCNp3oXqP8t+xjL3iX3emGShz2HcmaRv3HJd6uFF b3tX15vcLcstHN3brxV8Yplz+Jzq97Dcy496v+t7s0xRYinOSDTUYi4qTgQAJnnS51wCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1 X-RootMTR: 20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1 References: Cc: Jani Nikula , Daniel Vetter , Marek Szyprowski , Bartlomiej Zolnierkiewicz 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 dim finds remote name by matching repository urls, but different users requires different protocols/paths for remotes (ssh/git/https). Current code incorrectly translates provided url to alternatives, the patch fixes it. Signed-off-by: Andrzej Hajda --- dim | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/dim b/dim index 11aa675..d6d9269 100755 --- a/dim +++ b/dim @@ -223,15 +223,15 @@ fi # git branch name - dim assumes that the remote and local name match # url: # url to a repo, using ssh:// protocol -# git_url: -# url to a repo, but using anonymous git:// protocol +# urls: +# alternative urls to a repo, derived from url # # The below functions map between these. # function url_to_remote # url { - local url remote + local url urls remote url="$1" @@ -240,19 +240,17 @@ function url_to_remote # url return 1 fi - remote=$(git remote -v | grep -m 1 "$url" | cut -f 1) + urls=$(echo $url | sed -r \ + -e 's!ssh://(git.freedesktop.org)/git/(.*)!\0|git://anon\1/\2|https://anon\1/git/\2.git!' \ + -e 's!git://(git.kernel.org/.*)!\0|https://\1!') + remote=$(git remote -v | grep -m 1 -P "$urls" | 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) - - 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 $url" - echoerr "with a name of your choice." - return 1 - fi + echoerr "No git remote for url $url found in $(pwd)" + echoerr "Please set it up using:" + echoerr " $ git remote add url" + echoerr "with a name of your choice and url one of: ${urls//|/, }" + return 1 fi echo $remote