From patchwork Tue Jun 4 02:13:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 10974131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 647A96C5 for ; Tue, 4 Jun 2019 02:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5366728438 for ; Tue, 4 Jun 2019 02:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 475F128653; Tue, 4 Jun 2019 02:13:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD51928438 for ; Tue, 4 Jun 2019 02:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726223AbfFDCNe (ORCPT ); Mon, 3 Jun 2019 22:13:34 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:40198 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfFDCNd (ORCPT ); Mon, 3 Jun 2019 22:13:33 -0400 Received: by mail-ot1-f67.google.com with SMTP id u11so18055199otq.7 for ; Mon, 03 Jun 2019 19:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JLJ96cE5/hO/RotU+tmJuqqMmqwq3TJiqG71abmsIG8=; b=a5pFewgTp+pRh84a8KsMdRRT/HoX3IbtmzuXO9RTv8rJCwKnA47sLn3OhmAjH3Ma9N tJUEXRwQ4l5NNaGeaFWKjkDaF6WjqPQtnf4gpMUs8K1kN+AHONeSuLAg/BbKmZBqopPX 94T6d9DwiMm7dJCMDlNayqN5YVQWmVkb43ftOg/3iwuiQfSNr6NTD3oy2Gj/qY7g4VnS TU+1I9UAeCE3RZb8xar56YJH4+XVEP1Ee60inRXO3Pbtmd0kzTk6CmURirLyC5zSOcZX Wg5UCa2uhCkjZQSaOioiqibZe/B1pvGL3wzV7djygPyPChgEuEPBeSdVtnxXiQD35z5g XLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JLJ96cE5/hO/RotU+tmJuqqMmqwq3TJiqG71abmsIG8=; b=kguG1Dt3IR6wldAuPqmV1U6VghJG7E+aBO70wT82T3ZqSaxAoiQQwexGbg3jhDPbG3 pYdpIN06itXZ0LK087gU9BLYWH4TaQD0OsNwNQDlYYAd+UdqqFg12x+eQkiBXscoD0+l VWzJHfi7RUwB75ZWJG3Fui3KZyfvJtUWO6ms2v5reuBo6MKc2WFAaQviq88w22aE/CMM lhWA8g9VEP6tyo3R6ANl9wIEsflR8p7mzdU+WmiOdHTM/GyIckw/SYzbXmjHwuk6Gm4+ NtDiK4xrQfhLtnMf7mfgG6QUmFDSUrW3r3SlS41h5opHEZmV49huoQqWt+ryozIyc5Qz GhPA== X-Gm-Message-State: APjAAAUEJty2MApBZhJ9h7mznGmce4y4z6jkGu7vdtscYPzWjAqweTaO f0gYRs4cC12bGsXmy5UzQ+bkbxTTsWw= X-Google-Smtp-Source: APXvYqzrdNM5of+aO+7Gp7S6jChNJFnfDDP8VUOFglqXC/FKPVfeEvV/gSaCimRuGKnR51pfT+Xd6Q== X-Received: by 2002:a9d:3285:: with SMTP id u5mr3704767otb.266.1559614413015; Mon, 03 Jun 2019 19:13:33 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id m32sm4385340otc.55.2019.06.03.19.13.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 19:13:32 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Felipe Contreras Subject: [RFC/PATCH 1/5] t5801 (remote-helpers): cleanup refspec stuff Date: Mon, 3 Jun 2019 21:13:26 -0500 Message-Id: <20190604021330.16130-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604021330.16130-1-felipe.contreras@gmail.com> References: <20190604021330.16130-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code is much simpler this way, specially thanks to: git fast-export --refspec Signed-off-by: Felipe Contreras --- t/t5801-remote-helpers.sh | 8 ++++---- t/t5801/git-remote-testgit | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh index d04f8007e0..48bed7c2fe 100755 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -126,7 +126,7 @@ test_expect_success 'forced push' ' ' test_expect_success 'cloning without refspec' ' - GIT_REMOTE_TESTGIT_REFSPEC="" \ + GIT_REMOTE_TESTGIT_NOREFSPEC=1 \ git clone "testgit::${PWD}/server" local2 2>error && test_i18ngrep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD @@ -135,7 +135,7 @@ test_expect_success 'cloning without refspec' ' test_expect_success 'pulling without refspecs' ' (cd local2 && git reset --hard && - GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) && + GIT_REMOTE_TESTGIT_NOREFSPEC=1 git pull 2>../error) && test_i18ngrep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD ' @@ -145,8 +145,8 @@ test_expect_success 'pushing without refspecs' ' (cd local2 && echo content >>file && git commit -a -m ten && - GIT_REMOTE_TESTGIT_REFSPEC="" && - export GIT_REMOTE_TESTGIT_REFSPEC && + GIT_REMOTE_TESTGIT_NOREFSPEC=1 && + export GIT_REMOTE_TESTGIT_NOREFSPEC && test_must_fail git push 2>../error) && test_i18ngrep "remote-helper doesn.t support push; refspec needed" error ' diff --git a/t/t5801/git-remote-testgit b/t/t5801/git-remote-testgit index 752c763eb6..f2b551dfaf 100755 --- a/t/t5801/git-remote-testgit +++ b/t/t5801/git-remote-testgit @@ -11,13 +11,10 @@ fi url=$2 dir="$GIT_DIR/testgit/$alias" -prefix="refs/testgit/$alias" -default_refspec="refs/heads/*:${prefix}/heads/*" +refspec="refs/heads/*:refs/testgit/$alias/heads/*" -refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}" - -test -z "$refspec" && prefix="refs" +test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" && refspec="" GIT_DIR="$url/.git" export GIT_DIR @@ -81,10 +78,10 @@ do echo "feature done" git fast-export \ + ${refspec:+"--refspec=$refspec"} \ ${testgitmarks:+"--import-marks=$testgitmarks"} \ ${testgitmarks:+"--export-marks=$testgitmarks"} \ - $refs | - sed -e "s#refs/heads/#${prefix}/heads/#g" + $refs echo "done" ;; export) From patchwork Tue Jun 4 02:13:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 10974133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05BE86C5 for ; Tue, 4 Jun 2019 02:13:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E96F828438 for ; Tue, 4 Jun 2019 02:13:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDF3328653; Tue, 4 Jun 2019 02:13:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 804E928438 for ; Tue, 4 Jun 2019 02:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726292AbfFDCNg (ORCPT ); Mon, 3 Jun 2019 22:13:36 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:33262 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfFDCNf (ORCPT ); Mon, 3 Jun 2019 22:13:35 -0400 Received: by mail-oi1-f194.google.com with SMTP id q186so14443119oia.0 for ; Mon, 03 Jun 2019 19:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kx4d2muhZB2o265hqWGguwiqE3bKLdJqG3ngIRcLfa4=; b=VrHjiaThsNukneCIehA8BTYu1PMECbyODzKRy8d8uqteZ9jaBhrvtZLbU8JShE09RC fwQjxOsFTUOWfMDuHBqNuOFMwvSBm7U30tNZuR8pwI+Z8j8o4jd3Yhx3qZpkklKHckKt ioq9NsML2tkVXDLQHWuUr/fNHhZeeLDO3gnTACdw6aYARwMqLEo5AvOeyV/d2u8eklIV LJeXMvmCL8rD6U09ATC6q/bjz4xfyVNA+hPF7CKnyEfsiNadgkwIC0mVNBFCVcUWT/Lu 8z/WZrT3cM7CKnXhWllBXpN9TjF938SKepMrCrXsLrN+EVSplIU6eFtFDwg1Rfq20+ya arMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kx4d2muhZB2o265hqWGguwiqE3bKLdJqG3ngIRcLfa4=; b=KAduYPGax2QQCU8NwFB3B4aCQrWnacdsMnw/gR66EEeAQMMQl5gkuokhNrT6pxQTPJ lrFftpCnWELsbhcxxnZJ60Un/fKdWLDXjfYgdo7/OK4/pg/Rla/LuTxEZ63ZZ8Aw6CIR viN/9ffzJZq1i3wifMySAJFE/A0bz2YNpzakVskkVWUi5MHhU6C4nkxjlAqMITckL5nw Kh6csuHsGzmv23rs4L95FFVcg1NnADABusKKsv1SUGQs+DMapXFX1hkFch+tjlFG8EmL UBro8lY1PAQ2nOCdrWRBtK7MkuAGU8LnIEpX1bomF3Lvchpx1ve18rB6DJWsU84wjMuP 98qA== X-Gm-Message-State: APjAAAUYy9cpxgabV16AM+4NYAg4sq6wcCIfyoOrgc26mCZzAhkGBieN 786Lr136J0F9xRNMc3na5Sne9WDn/m8= X-Google-Smtp-Source: APXvYqw3JHHeObw/+CL52+rUIAwwSMD47/4Cb5W2ldxdEp9R9+icWrKfh0Nr+S/ec9Nt8pL7YFuonA== X-Received: by 2002:aca:abd8:: with SMTP id u207mr1915454oie.136.1559614414357; Mon, 03 Jun 2019 19:13:34 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id o128sm6199384oih.48.2019.06.03.19.13.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 19:13:33 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Felipe Contreras Subject: [RFC/PATCH 2/5] t5801 (remote-helpers): add test to fetch tags Date: Mon, 3 Jun 2019 21:13:27 -0500 Message-Id: <20190604021330.16130-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604021330.16130-1-felipe.contreras@gmail.com> References: <20190604021330.16130-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This used to work, but commit e198b3a740 broke it. e198b3a740 (fetch: replace string-list used as a look-up table with a hashmap) Probably all remote helpers that use the import method are affected, but we didn't catch the issue. Signed-off-by: Felipe Contreras --- t/t5801-remote-helpers.sh | 10 ++++++++++ t/t5801/git-remote-testgit | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh index 48bed7c2fe..238774bc17 100755 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -303,4 +303,14 @@ test_expect_success 'fetch url' ' compare_refs server HEAD local FETCH_HEAD ' +test_expect_failure 'fetch tag' ' + (cd server && + git tag v1.0 + ) && + (cd local && + git fetch + ) && + compare_refs local v1.0 server v1.0 +' + test_done diff --git a/t/t5801/git-remote-testgit b/t/t5801/git-remote-testgit index f2b551dfaf..6b9f0b5dc7 100755 --- a/t/t5801/git-remote-testgit +++ b/t/t5801/git-remote-testgit @@ -12,9 +12,14 @@ url=$2 dir="$GIT_DIR/testgit/$alias" -refspec="refs/heads/*:refs/testgit/$alias/heads/*" +h_refspec="refs/heads/*:refs/testgit/$alias/heads/*" +t_refspec="refs/tags/*:refs/testgit/$alias/tags/*" -test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" && refspec="" +if test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" +then + h_refspec="" + t_refspec="" +fi GIT_DIR="$url/.git" export GIT_DIR @@ -37,7 +42,8 @@ do capabilities) echo 'import' echo 'export' - test -n "$refspec" && echo "refspec $refspec" + test -n "$h_refspec" && echo "refspec $h_refspec" + test -n "$t_refspec" && echo "refspec $t_refspec" if test -n "$gitmarks" then echo "*import-marks $gitmarks" @@ -49,7 +55,7 @@ do echo ;; list) - git for-each-ref --format='? %(refname)' 'refs/heads/' + git for-each-ref --format='? %(refname)' 'refs/heads/' 'refs/tags/' head=$(git symbolic-ref HEAD) echo "@$head HEAD" echo @@ -78,7 +84,8 @@ do echo "feature done" git fast-export \ - ${refspec:+"--refspec=$refspec"} \ + ${h_refspec:+"--refspec=$h_refspec"} \ + ${t_refspec:+"--refspec=$t_refspec"} \ ${testgitmarks:+"--import-marks=$testgitmarks"} \ ${testgitmarks:+"--export-marks=$testgitmarks"} \ $refs From patchwork Tue Jun 4 02:13:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 10974135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 431BB92A for ; Tue, 4 Jun 2019 02:13:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 319A7285AB for ; Tue, 4 Jun 2019 02:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2620C28653; Tue, 4 Jun 2019 02:13:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C91532866C for ; Tue, 4 Jun 2019 02:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726303AbfFDCNh (ORCPT ); Mon, 3 Jun 2019 22:13:37 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:45339 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfFDCNg (ORCPT ); Mon, 3 Jun 2019 22:13:36 -0400 Received: by mail-ot1-f66.google.com with SMTP id t24so4334690otl.12 for ; Mon, 03 Jun 2019 19:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UFBefJvUzI90CP/0uzCa8e6rEEfs8QVpQrzPCOWnhx8=; b=ExRe2twLdXmelIAKAK9iufDDhNC9BdVHLbNFsAmv0bMZ9zh/PF42IDN4JtAShaoI2J XQ3kJmO/de8l67Wj9TM8AqK0AuOZ2/hneKTz45ybA50GRLzlQeggux9dWM4N3TP1ACq8 rLuKILLEgBQQ0NJe21HFbiB6Hs0NE9KVqtaneaKv6VXzAm3QMhhe/pgPFjIu8+BjadKk BKohtpFmd8Yd34NNORKQN6v+BB9hkQmI35U9sY3rDiv1zqj6OUsM9u/y5l4t+k6FRALB UAPzjeLtOgN6CxkwVgkPZFzinRec+YXfmV9dilNM2b0zrdfy6k4QJ7taqxibUrogOMoz /Hnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UFBefJvUzI90CP/0uzCa8e6rEEfs8QVpQrzPCOWnhx8=; b=UpiVXV51rJ0Yae6v0eNumEOmpF0cNyicqMY8Vc4/iqFuhkrEfn99YvtkgWYcNenpxM xQ2Ax78NHGRJnU2eXITEuF9v4S0uqEdu6TxQSpZEdwUFx9sumamfpN9INpsxsPE6zGus fR3IFIUETDYswRxq8BNLp6h1j1UlyGZeWe01NjneI28vSfnQ0arix04S114BSJkG/nFj MU4QJbZby+b+9w2kpI2idnlrTs6g/Wo5B2/GM50AFeeesgJlXLi6YH5Vo4WTmGzrtcmT Hdrn+fdrwFur+ObrtC0LXTg0/di8WO24LWgWvlLrIHEVIP9PqoR5Lo8/F0QLFV3/E83S ECGQ== X-Gm-Message-State: APjAAAXI627zkCG4z+sjBpDXx/JbyuZA258Ye7fksGHflcEJYUuG2+GX AjtIFt9Ri0a+uWP/fpTNGrUq0ZgD8qI= X-Google-Smtp-Source: APXvYqygJ8Uc3sm7UDmIEl/CJPtgmvgK3Vgjf7M+qhoJKNuT8Jks9FovpAt5lPj1mmWt9E/gf9yxGQ== X-Received: by 2002:a05:6830:2041:: with SMTP id f1mr2106589otp.167.1559614415711; Mon, 03 Jun 2019 19:13:35 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id n10sm3183282otq.63.2019.06.03.19.13.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 19:13:35 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Felipe Contreras Subject: [RFC/PATCH 3/5] fetch: trivial cleanup Date: Mon, 3 Jun 2019 21:13:28 -0500 Message-Id: <20190604021330.16130-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604021330.16130-1-felipe.contreras@gmail.com> References: <20190604021330.16130-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Create a helper function to clear an item. The way items are cleared has changed, and will change again soon. No functional changes. Signed-off-by: Felipe Contreras --- builtin/fetch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 4ba63d5ac6..8af5e319f1 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -287,6 +287,11 @@ static int refname_hash_exists(struct hashmap *map, const char *refname) return !!hashmap_get_from_hash(map, strhash(refname), refname); } +static void clear_item(struct refname_hash_entry *item) +{ + oidclr(&item->oid); +} + static void find_non_local_tags(const struct ref *refs, struct ref **head, struct ref ***tail) @@ -319,7 +324,7 @@ static void find_non_local_tags(const struct ref *refs, !will_fetch(head, ref->old_oid.hash) && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); item = NULL; continue; } @@ -333,7 +338,7 @@ static void find_non_local_tags(const struct ref *refs, if (item && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); item = NULL; @@ -354,7 +359,7 @@ static void find_non_local_tags(const struct ref *refs, if (item && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); /* * For all the tags in the remote_refs_list, From patchwork Tue Jun 4 02:13:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 10974139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E25C56C5 for ; Tue, 4 Jun 2019 02:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D145528438 for ; Tue, 4 Jun 2019 02:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5D2B28653; Tue, 4 Jun 2019 02:13:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7896928438 for ; Tue, 4 Jun 2019 02:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbfFDCNk (ORCPT ); Mon, 3 Jun 2019 22:13:40 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:42580 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbfFDCNi (ORCPT ); Mon, 3 Jun 2019 22:13:38 -0400 Received: by mail-ot1-f65.google.com with SMTP id i2so17086342otr.9 for ; Mon, 03 Jun 2019 19:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=od4biYS3NOd6r2UJvGzkdOrtz3Tfd1qCtNAQC3sZNDo=; b=lJPv6GVHONyQ0217kTL6kkHzhVr+VmUy93Hxdab2PObQsyW8o6Xq/1DzexJRb6/wXU tlEPvj0eahD1wSQOtfB8W809nmCrv7L4kLFPSxACONVRYXqLw+hPaYA7whQu9pH/e7Yi gi91RAUppV9pwr0VplMIBYWzaQ2FhQjU71BIO2svRqJzgv9NKblQsDLl2iEXEAeSCbUz aeaAr/WstdqjHUWp7SfNBczddOyOZRxSF6OSGrURlryaDnCXToUk0FRdOCGAFNAW7Xk9 5IWT9zXNtIbfsatMgOhxWhKP8W28x5wTOq9I51v3DTzo7tVSt7LOT/nLHkwkqQ+aszyn v8EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=od4biYS3NOd6r2UJvGzkdOrtz3Tfd1qCtNAQC3sZNDo=; b=cDOCav9JCcofCmjB3UHsQ6OvMXqIkJfTj6lXkMJhH0aBLaJ8Y4YEB2adiKol5iRP4P 1/via9zhY/RJlnDyiCUwB8oP67ltXTE6CG348RLlZ9eDGX2Ro4bOEstSmVS5SWGaB+oF 8tIShvYuyhojAHnW9mTmUe+RGoQWWHriR4u6qB+L0lQ+/aoFFUoVhM6rHS/tuFjNOU6p f0+DiKB1itEH+sYrcd/Mb5LEP4hocce5sGIbBNnDO1VWG4842cMJ2y6ngeNk+OxPGFIX 3TnurClKFoWmOW3g4Yt8WOA19BrKInTL7jcYJFLuimnP0YDLsDJcLG1XPcwzjC8gFcLn ytEw== X-Gm-Message-State: APjAAAWGHYScxUJ0M6Zm35SqWg6v7xQs9SDJyHmS+VX4VQ/1Sze2eaxk EQbLP0BADZfuexMN9CW/apN2oL4YDx8= X-Google-Smtp-Source: APXvYqy9iGwl1YZWTWCZcpohx+XJclgF886VMzBeukeZcZtXx9vGyPgclCFlk146hQ9T9v3OSsI8kw== X-Received: by 2002:a9d:6503:: with SMTP id i3mr3480276otl.139.1559614416977; Mon, 03 Jun 2019 19:13:36 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id s201sm6533364oie.40.2019.06.03.19.13.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 19:13:36 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Felipe Contreras Subject: [RFC/PATCH 4/5] fetch: make the code more understandable Date: Mon, 3 Jun 2019 21:13:29 -0500 Message-Id: <20190604021330.16130-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604021330.16130-1-felipe.contreras@gmail.com> References: <20190604021330.16130-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The comment makes it seem as if the condition is the other way around. The exception is when the oid is null, so check for that. Signed-off-by: Felipe Contreras --- builtin/fetch.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 8af5e319f1..9dc551551e 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -367,19 +367,21 @@ static void find_non_local_tags(const struct ref *refs, */ for_each_string_list_item(remote_ref_item, &remote_refs_list) { const char *refname = remote_ref_item->string; + struct ref *rm; item = hashmap_get_from_hash(&remote_refs, strhash(refname), refname); if (!item) BUG("unseen remote ref?"); /* Unless we have already decided to ignore this item... */ - if (!is_null_oid(&item->oid)) { - struct ref *rm = alloc_ref(item->refname); - rm->peer_ref = alloc_ref(item->refname); - oidcpy(&rm->old_oid, &item->oid); - **tail = rm; - *tail = &rm->next; - } + if (is_null_oid(&item->oid)) + continue; + + rm = alloc_ref(item->refname); + rm->peer_ref = alloc_ref(item->refname); + oidcpy(&rm->old_oid, &item->oid); + **tail = rm; + *tail = &rm->next; } hashmap_free(&remote_refs, 1); string_list_clear(&remote_refs_list, 0); From patchwork Tue Jun 4 02:13:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 10974137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 117F392A for ; Tue, 4 Jun 2019 02:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00C4628438 for ; Tue, 4 Jun 2019 02:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E973828653; Tue, 4 Jun 2019 02:13:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C4C28438 for ; Tue, 4 Jun 2019 02:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbfFDCNk (ORCPT ); Mon, 3 Jun 2019 22:13:40 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:39878 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfFDCNj (ORCPT ); Mon, 3 Jun 2019 22:13:39 -0400 Received: by mail-oi1-f196.google.com with SMTP id m202so3275881oig.6 for ; Mon, 03 Jun 2019 19:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ef9ObsAXUM7EDnDMgoIFzL7nq7HMDiW11MxW4p26eIA=; b=dJOJC031Nf/3RZCGOwA/Y7v2EuYMWyUKEwoy1lv41iuVNjEhSwr8CfsLdDmdbG0Mt0 pdzVKJkvo9jWVrtoSYsXYr4lNe3N6gWxRmCfZ3MnmWCN+klMQeQUgJU6snxpSfxpbQ29 zSqSLLs383z5u/XDLbw+WlmXWvwnG0JqFkf8IAPlPcVkf7USv8QdKQ4sxFedrchgWs+X BdZNifZnquqvK0qLju5+i/cLOeWJW7NK9smTcdpk74J7I/zsE35IiCfUQ0QXe0rWQBIM brDnjF6wRk4KCUsmCMC/YE3DrTmEsq7oxJWITwwTcgqX81LvTTQa5Lp5bI9iS2fRGHz7 rpfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ef9ObsAXUM7EDnDMgoIFzL7nq7HMDiW11MxW4p26eIA=; b=ASQ1eBqLuQj30twUMZ8O9+zoDc/4d5RCuuprUeFNQLQj3AHDaEWIvJkqJVpEFgRbQd qBtQ/4WyOx6iCM65GTcojAZLK6IyTPNe7R5q+XWkT1FwG+WDq7rZBljUQpJ23jRkWvYb Z8F5wwGmzdFEaLX0usHFR33yN2SX9eJGtedLL8M9lG8vhPNpRAOX9uq9PsCiGt2dXDol nf8FTtfFI5IZKO0Ito2aJ/z4A8QuO6rRifkPRSa3/IE5pZEDwBYFcwe9uuJh9SCSydD0 Gg9TYzxygbFLNi7iDR8kFsgjvmx2v5Mf3+sZs9otAnZi6lX5Dzd1T4eZnQ1fDLU5U1q2 oUYg== X-Gm-Message-State: APjAAAWDW2Tl1dvBUszYMYcem4VKzdjF5vTGveDtmROxZAlhHmkDKHS6 AglkjKuFgFHFMg1llWHhFNpovUTF60I= X-Google-Smtp-Source: APXvYqw3sLBonfHdtHy3e3RVkUjCz2H57FDt7n8677HccPOd7DwumpCKTaonUE1+JML1yJ7zSE+ucw== X-Received: by 2002:aca:5e87:: with SMTP id s129mr2922853oib.95.1559614418362; Mon, 03 Jun 2019 19:13:38 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id m17sm5497913otl.38.2019.06.03.19.13.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 19:13:37 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Felipe Contreras Subject: [RFC/PATCH 5/5] fetch: fix regression with transport helpers Date: Mon, 3 Jun 2019 21:13:30 -0500 Message-Id: <20190604021330.16130-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604021330.16130-1-felipe.contreras@gmail.com> References: <20190604021330.16130-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit e198b3a740 changed the behavior of fetch with regards to tags. Before, null oids where not ignored, now they are, regardless of whether the refs have been explicitly cleared or not. e198b3a740 (fetch: replace string-list used as a look-up table with a hashmap) When using a transport helper the oids can certainly be null. So now tags are ignored and fetching them is impossible. This patch fixes that by having a specific flag that is set only when we explicitly want to ignore the refs, restoring the original behavior. Signed-off-by: Felipe Contreras --- builtin/fetch.c | 5 +++-- t/t5801-remote-helpers.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 9dc551551e..f2be50a4a3 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -239,6 +239,7 @@ static int will_fetch(struct ref **head, const unsigned char *sha1) struct refname_hash_entry { struct hashmap_entry ent; /* must be the first member */ struct object_id oid; + int ignore; char refname[FLEX_ARRAY]; }; @@ -289,7 +290,7 @@ static int refname_hash_exists(struct hashmap *map, const char *refname) static void clear_item(struct refname_hash_entry *item) { - oidclr(&item->oid); + item->ignore = 1; } static void find_non_local_tags(const struct ref *refs, @@ -374,7 +375,7 @@ static void find_non_local_tags(const struct ref *refs, BUG("unseen remote ref?"); /* Unless we have already decided to ignore this item... */ - if (is_null_oid(&item->oid)) + if (item->ignore) continue; rm = alloc_ref(item->refname); diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh index 238774bc17..2d6c4a281e 100755 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -303,7 +303,7 @@ test_expect_success 'fetch url' ' compare_refs server HEAD local FETCH_HEAD ' -test_expect_failure 'fetch tag' ' +test_expect_success 'fetch tag' ' (cd server && git tag v1.0 ) &&