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-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, 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 6C6491F4B4 for ; Mon, 5 Apr 2021 17:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238661AbhDERcA (ORCPT ); Mon, 5 Apr 2021 13:32:00 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:34528 "EHLO mail-ed1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237872AbhDERcA (ORCPT ); Mon, 5 Apr 2021 13:32:00 -0400 Received: by mail-ed1-f53.google.com with SMTP id ba6so5846135edb.1 for ; Mon, 05 Apr 2021 10:31:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FsnpRqpF3MYARRSF94pQmt0r63WuT1zUDsgQB6TYous=; b=oa8P2VYNo+YPFObVRiShWNOJ7U3+Y8UcWpFTwPcN2L5Pnes37sSk/2TNQllDf8tIZs uCxtndwQvrZifCYkr+MLFk0T/igRB9/OHuQ5a4xV2E3UzBv8s/+M2/l9DbMtb5xu2JPk 4/CSS2DcnceUtwyFQBsccxtxmSU+WtyNkyD90iyCDmvor2iFng5WzcbvrRvwCgiCcsDc b6R7qkvggSdWQDj6SvyNEL3sd0Gcc5a9CDUIdDrIZ5IXxlS3DZcIt19b8IdUnFAKRVQM uDNbCOh6Ix8tv5Qe0EPWh6dT9P4nc/nu7R1VYSr7YLzwBIwxNT7XwS4b8Xuqzfi/3buP HZ0Q== X-Gm-Message-State: AOAM532P5xt/jSPwRykV1fzoFYvTagxmnCSNXp5qrdWbsSDyFg+VAWWL Vw1kDAlXMAmwrrvGOc1UYDVVmr4VsR7YpAoNozU= X-Google-Smtp-Source: ABdhPJzpOxVdEHHQov9xteqSkCgdaDWadIf9gBjOhQAFmTMPXS0OWuLMYYd4Lv2jsHPOq9NyH0gXbrAF4NKDMz6OdRc= X-Received: by 2002:aa7:c551:: with SMTP id s17mr33025562edr.291.1617643912868; Mon, 05 Apr 2021 10:31:52 -0700 (PDT) MIME-Version: 1.0 References: <2b74889c2a323f03be477ffdf9ff388405779c3b.1617627856.git.gitgitgadget@gmail.com> In-Reply-To: <2b74889c2a323f03be477ffdf9ff388405779c3b.1617627856.git.gitgitgadget@gmail.com> From: Eric Sunshine Date: Mon, 5 Apr 2021 13:31:42 -0400 Message-ID: Subject: Re: [PATCH 2/5] test-lib: use exact match for test_subcommand To: Derrick Stolee via GitGitGadget Cc: Git List , Tom Saeger , Junio C Hamano , Derrick Stolee , Derrick Stolee Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Apr 5, 2021 at 9:04 AM Derrick Stolee via GitGitGadget wrote: > The use of 'grep' inside test_subcommand uses general patterns, leading > to sometimes needing escape characters to avoid incorrect matches. > Further, some platforms interpret different glob characters differently. These are regular expression metacharacters, not glob characters. A more general way to say this might be: Furthermore, it can be difficult to know which characters need escaping since the actual regular expression language implemented by various `grep`s differs between platforms; for instance, some may employ pure BRE, whereas others a mix of BRE & ERE. Sidestep this difficulty by using `grep -F`... > Use 'grep -F' to use an exact match. This requires removing escape > characters from existing callers. Luckily, this is only one test that > expects refspecs as part of the subcommand. > > Reported-by: Eric Sunshine > Signed-off-by: Derrick Stolee The Reported-by: feels a bit unusual in this context. Perhaps Helped-by: would be more appropriate. > diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh > @@ -142,8 +142,8 @@ test_expect_success 'prefetch multiple remotes' ' > - test_subcommand git fetch remote1 $fetchargs +refs/heads/\\*:refs/prefetch/remote1/\\* - test_subcommand git fetch remote2 $fetchargs +refs/heads/\\*:refs/prefetch/remote2/\\* + test_subcommand git fetch remote1 $fetchargs +refs/heads/*:refs/prefetch/remote1/* + test_subcommand git fetch remote2 $fetchargs +refs/heads/*:refs/prefetch/remote2/*