From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B733B1F934 for ; Thu, 1 Oct 2020 03:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730505AbgJADqZ (ORCPT ); Wed, 30 Sep 2020 23:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbgJADqY (ORCPT ); Wed, 30 Sep 2020 23:46:24 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DEFAC0613D0 for ; Wed, 30 Sep 2020 20:46:22 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id c18so3937613wrm.9 for ; Wed, 30 Sep 2020 20:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=t+pghuU5Gv83eMVih7dQHTihGijXyL5XBxWL7n3ryDI=; b=j9Qs8Pu5V0VZy3UKvd3eb3DUcvKitp0o9Tv6sXCNU9mmc2QcvI9knkXb1mYuECVwB5 T8hzLbIFJpSEzu6EVe59PpNY1YV/Sle7nGbMFis4rZwvks5VtLouDh7aMW8Lq74GXYQ9 nPviC3a1xjVewCQzwwhIAmZUGDCdV3RrfwChz1EJHhxVcZ0G4QhQt/ofEDv30DE2PkU3 NTgMbsoA4dHx2DJVwNGS3yapZoR6Le51JLkKYDVU5y/byBuVQ0n8txiccbc5IjCnkH9K 3GMvKjT37wyuPA5X2sPg7e/wCJZoWOekqkYK0Xk/qYBR/R2okCiSKNBNXWKP0nRVvFn2 al/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=t+pghuU5Gv83eMVih7dQHTihGijXyL5XBxWL7n3ryDI=; b=niVnI6EwDgKjDCRBobuYLv04bBv8tg/pxvpyTA0ZEsxEmKlTeg/bLIggUmNwb6yHKP 1/7dOiKFkfluAt9k2BV0pP5gq69cgJGnz/ygJ3ChDA8H14thppqYVyzqSmpy/VKILoQ2 UM+/6cW4qmhGHriJlomYuszvMPQUYcBC+odfbsBp/egQyJQ+e2gQWQ9wL9cVfzkYnXVX wG+NmjfMpNa82JZlTrnbmxR59vkUgGrzUK2jRH4sKaLlWv2NImr2M17z+oHrSUoRWZpH 60ukzAhmXCVtQ/YtUfb7es5K1y5U7PQULvO/t4IpFOEgwKLU3rUGXAH6dka2b6lm9klP Fruw== X-Gm-Message-State: AOAM5319hXdserEatcsw14QPE1sPhghWJo3hRseubqv/5KZbsx6o3Nx1 avEXNLt6uSZHPVMGwXLGvSSbpKU5ql4= X-Google-Smtp-Source: ABdhPJw2H/aGG3kgg4Q9Br149q7ROwLz+dcrp77cOELzhfsVEdpJiCoiZR0m38pkFosDKsWMeOKc7g== X-Received: by 2002:adf:e7ce:: with SMTP id e14mr6110309wrn.43.1601523980979; Wed, 30 Sep 2020 20:46:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f23sm5389961wmf.6.2020.09.30.20.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 20:46:20 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Sean Barag via GitGitGadget" Date: Thu, 01 Oct 2020 03:46:12 +0000 Subject: [PATCH v3 3/7] remote: add tests for add and rename with invalid names Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Derrick Stolee , Jeff King , Eric Sunshine , Taylor Blau , Sean Barag , Andrei Rybak , Sean Barag , Sean Barag Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Sean Barag In preparation for a future patch that moves `builtin/remote.c`'s remote-name validation, ensure `git remote add` and `git remote rename` report errors when the new name isn't valid. Signed-off-by: Sean Barag --- t/t5505-remote.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 8d62edd98b..1156f52069 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -179,6 +179,13 @@ test_expect_success 'rename errors out early when deleting non-existent branch' ) ' +test_expect_success 'rename errors out early when when new name is invalid' ' + test_config remote.foo.vcs bar && + echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect && + test_must_fail git remote rename foo invalid...name 2>actual && + test_i18ncmp expect actual +' + test_expect_success 'add existing foreign_vcs remote' ' test_config remote.foo.vcs bar && echo "fatal: remote foo already exists." >expect && @@ -194,6 +201,12 @@ test_expect_success 'add existing foreign_vcs remote' ' test_i18ncmp expect actual ' +test_expect_success 'add invalid foreign_vcs remote' ' + echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect && + test_must_fail git remote add invalid...name bar 2>actual && + test_i18ncmp expect actual +' + cat >test/expect <