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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id C49AB1F487 for ; Wed, 25 Mar 2020 06:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725954AbgCYGgx (ORCPT ); Wed, 25 Mar 2020 02:36:53 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54522 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgCYGgx (ORCPT ); Wed, 25 Mar 2020 02:36:53 -0400 Received: by mail-wm1-f67.google.com with SMTP id c81so1073050wmd.4 for ; Tue, 24 Mar 2020 23:36: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=Vk9msG/R4wH1dDFbiRqOK2hziQzDvLXdB4bAP1xwg2k=; b=PMwC79ekh6nF1dZqD9p41saboaXUm6Dd0AmfFc0ef7Ge2zpJh8f/z8B2hOFISI6n8E zbOoDFy3PpSZwcJvn/bCgo5mMlxBQjpzR4TCdxhhlZy/NhKS+Yk3yBJW1entorieBtpd ouOTOsO6q5gbnMGDVUcEvdvish9gaeWZNQNoIsRHjy15pN0lzmRZiXEaklxTr2/eCmC1 HCBVnQAJKfkLmTjWSXGUS3qppJX5CgSQQONJvzWqEF3cKt5xifknEOTE1aD4hu4rzFGD 4D5D0QBCqIDLW06Am39KaHzZiSKIfSiikUmM4GbRy5f0pIT0d0BLqkhjMvMHA7ptDziT ToQg== X-Gm-Message-State: ANhLgQ1nTcbA6zG8sP4reQO3w2c+wpPEjZZz6TIXrGYMzMsMenDRpB7l nhHko0B2Fg/T+IK6NUPxZjiYFXO8E1zw00U0FA0= X-Google-Smtp-Source: ADFU+vtRojFZ8DodmWZnS8y6afBRVt528JRX0iOPIK/9Vv6VXw1tD072/885/giM+SG1rDb2F+oAt8hgtPbgUVUoaDA= X-Received: by 2002:a1c:a78a:: with SMTP id q132mr1862593wme.107.1585118212324; Tue, 24 Mar 2020 23:36:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Eric Sunshine Date: Wed, 25 Mar 2020 02:36:41 -0400 Message-ID: Subject: Re: [PATCH 8/8] t5801: teach compare_refs() to accept ! To: Junio C Hamano Cc: Denton Liu , Git Mailing List Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Mar 25, 2020 at 2:31 AM Junio C Hamano wrote: > Denton Liu writes: > > compare_refs() { > > + fail= && > > + if test "x$1" = 'x!' > > + then > > + fail='!' && > > + shift > > + fi && > > git --git-dir="$1/.git" rev-parse --verify $2 >expect && > > git --git-dir="$3/.git" rev-parse --verify $4 >actual && > > - test_cmp expect actual > > + eval $fail test_cmp expect actual > > } > > - test_must_fail compare_refs local signed-tag server signed-tag > > + compare_refs ! local signed-tag server signed-tag > > While this is not wrong per-se, I do not know why we cannot just use > > ! compare_refs local signed-tag server signed-tag > > i.e. "we expect these two repositories have different tags"? As mentioned in the commit message, if one of the git-rev-parse invocations fails unexpectedly, then compare_refs() would return early with a failure code, but the "!" would then (undesirably) turn that failure into a success. We don't want to lose a failure code from git-rev-parse, so the simple use of "! compare_refs ..." is avoided.