From patchwork Wed Mar 25 05:54:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5AF8817D4 for ; Wed, 25 Mar 2020 05:55:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B3B220775 for ; Wed, 25 Mar 2020 05:55:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U4YoYVaL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbgCYFzP (ORCPT ); Wed, 25 Mar 2020 01:55:15 -0400 Received: from mail-qv1-f47.google.com ([209.85.219.47]:40630 "EHLO mail-qv1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726264AbgCYFzP (ORCPT ); Wed, 25 Mar 2020 01:55:15 -0400 Received: by mail-qv1-f47.google.com with SMTP id cy12so485058qvb.7 for ; Tue, 24 Mar 2020 22:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=r12iIEm0XSofXx3wqw9sbrMgiKngr/X8ryuhRvp0nSE=; b=U4YoYVaLspLIhpfCUu05gbfNAPYdCz8w5jQu33yBYiDvfhSuszYvsMyd87MWJoCCvh tVDBI7/v+r9wYn9qUKj5+kbnjmmY5RQ8QzBE/5pylRMzJshh66CGOlh6Fj8AHRBcma/f QKtMH6SUqkdpkeLln/2eTSwzZKjmwC2zxSK+KQNxwYQuEzT4Id3/bhRbWuZZsFoJCVUo Zw04olG84f5Yxs1R9lGQfho+hLeMviwMaew6GawnK5QURX/j/h2+IsChXAOr4U+0HY/w gukx+fkr2lCSGbls3DdCIdVJn16A2GTbN/HYCPrJkqRp8F/24Idcxafol+I2MPzVx6Of qxxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r12iIEm0XSofXx3wqw9sbrMgiKngr/X8ryuhRvp0nSE=; b=Zhkh59iNkogFksUlMtcL8hdAjMTUm4amME8P36aGc7Jbs02t8E0gmT/5wQ8naE3jbs vin3fJltO6KSoX2gtVmBLGUGjBzALKKU7rcvymXZDpHa5hFNn0u7VoW40jPXHczMk+el uZq3K9yXn/sUFOs8y/gNJ2sG8lK0cIAxHtHd680Qq7mqg2EePT6bUD7cvQJbKOgiO3MY 8+QqrbDGJd0FVXlP3Nkd8QgFQhKlQijKFMM1+aDSV6jLbe2b4KaNTZlIwcVXmPqsFlg7 zhSh94GXATqqCd2ce8cQRE6o0ErPyCO2tOdd1eEZc9bEIfnZX/nTI4ztTmjYKrumn9hU pp5g== X-Gm-Message-State: ANhLgQ3p8T9DTC0FVNTfAfYMXWu5HxjEDmGig9niXC+RnztPmWr1XLld er9bRUJm5kDxD9LmGusC8/UB2mnd X-Google-Smtp-Source: ADFU+vuKz380U2vs5Vl53zfx5vC65FPHSh4/sQLjOCO5uDVV9t1eaz4S8Jwy1lWu4siEvrDWxlwAgQ== X-Received: by 2002:ad4:4c82:: with SMTP id bs2mr1663072qvb.14.1585115713789; Tue, 24 Mar 2020 22:55:13 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:13 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 1/8] t5512: don't use `test_must_fail test_cmp` Date: Wed, 25 Mar 2020 01:54:48 -0400 Message-Id: <3d7dc8428d1992d3bc2802f5c828e8d77fe4de3b.1585115341.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since test_cmp() just wraps an external command, replace `test_must_fail test_cmp` with `! test_cmp`. Signed-off-by: Denton Liu --- t/t5512-ls-remote.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 04b35402c7..08b98f12b8 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -92,7 +92,7 @@ test_expect_success 'use "origin" when no remote specified' ' test_expect_success 'suppress "From " with -q' ' git ls-remote -q 2>actual_err && - test_must_fail test_cmp exp_err actual_err + ! test_cmp exp_err actual_err ' test_expect_success 'use branch..remote if possible' ' From patchwork Wed Mar 25 05:54:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9394A139A for ; Wed, 25 Mar 2020 05:55:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7417020714 for ; Wed, 25 Mar 2020 05:55:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="udvYPGXm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbgCYFzR (ORCPT ); Wed, 25 Mar 2020 01:55:17 -0400 Received: from mail-qt1-f179.google.com ([209.85.160.179]:34660 "EHLO mail-qt1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726264AbgCYFzQ (ORCPT ); Wed, 25 Mar 2020 01:55:16 -0400 Received: by mail-qt1-f179.google.com with SMTP id 10so1305869qtp.1 for ; Tue, 24 Mar 2020 22:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hzBtOCeXirYDUcUW+TlH01ogvvKrN//YJk3QfvJsTBU=; b=udvYPGXm/U/fqhhK5o9dpjPoK3ktCQfqhi5/TpTCeCZU1mCuLFLnrAmkj8gAfqS/xB bPunVZ/2iqEluhhUgu45cDWWSQFsbpjnoi3uKV4fFM6fIHgsIH7CkXoV+z0IGgeUxgsr /zPlmzn9HuQnzirMCDOxvz35oNL4FYnjZLqBtojTO/7dbMImMiEVRC3tkRW04j/nx++X oI2ErNuJ7HqWKuUjKCCqj4FXK7xdu2+SCf0Ug7OE/DiyVe/cbM3O2KYLf9lAXd8Ig4eI doLeyammmuaMJ0C8LACW6jZaSmDr+cvRjO5xTMw//MuW2pJEOBk2Ua1AlIcGvFJLyKdY 5mhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hzBtOCeXirYDUcUW+TlH01ogvvKrN//YJk3QfvJsTBU=; b=UfeFDYRgfcGXxqmFbiimKHrgQSXTISDBapvM1iunZoexWmTwygA9mHjiJdx56TOYed vXXQY6GaNXDZL5Rlg8MQAypSjN3FNlXAmwTRHGdGYgLLFvKzGpIuElUFg3gMT6RszQEU 2O296lNRcvx9FTPhO6k+PtK+u4jMFKhIcXzo9MlqsMmgogVkBIVeqIvqIpuIJxxcKnXQ zuU04u/4rZyZozzrbdDY3bRg83MU1hw/lSRiOpTyWWqOzm5yKJIPTFmAdoPkC1oNLvX9 Gc94ct5oG91HZEQ7Z56nG/WrltTlXZ1/hvl0alWypewNO3bGSi7F3eOZCxTl97V1B65t nUHw== X-Gm-Message-State: ANhLgQ3mG1qO6NqoRSW6JL9Fgzgs/bhS6EJRCo64SeTgG6xn0iuvFfZA gi91Vgk/EuFxDoE93cGdyK8Q0VGa X-Google-Smtp-Source: ADFU+vt6Hg+MDEapw05yeihxcFe6t2MpI+vl+pn1JHvqrWcQr5dN8uG+HhIlXoTjxdIWpA/67rfO2w== X-Received: by 2002:aed:2c06:: with SMTP id f6mr1362961qtd.337.1585115714907; Tue, 24 Mar 2020 22:55:14 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:14 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 2/8] t5512: generate references with generate_references() Date: Wed, 25 Mar 2020 01:54:49 -0400 Message-Id: <674de50db28a50554d7af6e5c869c427d06f78aa.1585115341.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The expected references are generated using a here-doc with some inline subshells. If one of the `git rev-parse` invocations within the subshells failed, its return code is swallowed and we won't know about it. Replace these here-docs with generate_references(), which actually reports when `git rev-parse` fails. Signed-off-by: Denton Liu --- t/t5512-ls-remote.sh | 50 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 08b98f12b8..62d02152c7 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -4,6 +4,14 @@ test_description='git ls-remote' . ./test-lib.sh +generate_references () { + for i + do + oid=$(git rev-parse "$i") || return 1 + printf '%s\t%s\n' "$oid" "$i" + done +} + test_expect_success setup ' >file && git add file && @@ -43,34 +51,19 @@ test_expect_success 'ls-remote self' ' ' test_expect_success 'ls-remote --sort="version:refname" --tags self' ' - cat >expect <<-EOF && - $(git rev-parse mark) refs/tags/mark - $(git rev-parse mark1.1) refs/tags/mark1.1 - $(git rev-parse mark1.2) refs/tags/mark1.2 - $(git rev-parse mark1.10) refs/tags/mark1.10 - EOF + generate_references refs/tags/mark refs/tags/mark1.1 refs/tags/mark1.2 refs/tags/mark1.10 >expect && git ls-remote --sort="version:refname" --tags self >actual && test_cmp expect actual ' test_expect_success 'ls-remote --sort="-version:refname" --tags self' ' - cat >expect <<-EOF && - $(git rev-parse mark1.10) refs/tags/mark1.10 - $(git rev-parse mark1.2) refs/tags/mark1.2 - $(git rev-parse mark1.1) refs/tags/mark1.1 - $(git rev-parse mark) refs/tags/mark - EOF + generate_references refs/tags/mark1.10 refs/tags/mark1.2 refs/tags/mark1.1 refs/tags/mark >expect && git ls-remote --sort="-version:refname" --tags self >actual && test_cmp expect actual ' test_expect_success 'ls-remote --sort="-refname" --tags self' ' - cat >expect <<-EOF && - $(git rev-parse mark1.2) refs/tags/mark1.2 - $(git rev-parse mark1.10) refs/tags/mark1.10 - $(git rev-parse mark1.1) refs/tags/mark1.1 - $(git rev-parse mark) refs/tags/mark - EOF + generate_references refs/tags/mark1.2 refs/tags/mark1.10 refs/tags/mark1.1 refs/tags/mark >expect && git ls-remote --sort="-refname" --tags self >actual && test_cmp expect actual ' @@ -212,17 +205,16 @@ test_expect_success 'protocol v2 supports hiderefs' ' test_expect_success 'ls-remote --symref' ' git fetch origin && - cat >expect <<-EOF && - ref: refs/heads/master HEAD - $(git rev-parse HEAD) HEAD - $(git rev-parse refs/heads/master) refs/heads/master - $(git rev-parse HEAD) refs/remotes/origin/HEAD - $(git rev-parse refs/remotes/origin/master) refs/remotes/origin/master - $(git rev-parse refs/tags/mark) refs/tags/mark - $(git rev-parse refs/tags/mark1.1) refs/tags/mark1.1 - $(git rev-parse refs/tags/mark1.10) refs/tags/mark1.10 - $(git rev-parse refs/tags/mark1.2) refs/tags/mark1.2 - EOF + echo "ref: refs/heads/master HEAD" >expect && + generate_references HEAD \ + refs/heads/master >>expect && + oid=$(git rev-parse HEAD) && + echo "$oid refs/remotes/origin/HEAD" >>expect && + generate_references refs/remotes/origin/master \ + refs/tags/mark \ + refs/tags/mark1.1 \ + refs/tags/mark1.10 \ + refs/tags/mark1.2 >>expect && # Protocol v2 supports sending symrefs for refs other than HEAD, so use # protocol v0 here. GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref >actual && From patchwork Wed Mar 25 05:54:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 857CC139A for ; Wed, 25 Mar 2020 05:55:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6549D20714 for ; Wed, 25 Mar 2020 05:55:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c0t8m5iE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727253AbgCYFzR (ORCPT ); Wed, 25 Mar 2020 01:55:17 -0400 Received: from mail-qv1-f67.google.com ([209.85.219.67]:46781 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbgCYFzR (ORCPT ); Wed, 25 Mar 2020 01:55:17 -0400 Received: by mail-qv1-f67.google.com with SMTP id m2so468759qvu.13 for ; Tue, 24 Mar 2020 22:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=i5YJcHss20tP7ZQ/brMc62KBT/ftaRdKhsrYV2CBJ6I=; b=c0t8m5iEEisWSubSs6B/ueGeNcQVOiUNxzdkDYmL3ZfkijihxFaMGMxVDZr93qdnhS gcNlD/P7nrZYo9oti/Vaa76Clp3oiNTzk6z9HrhaBsN4lhuXX/Jw6SO00MK22tiLPspc cZXTLziuJ5hAPJSK+GI7LgULUdqa4KHtJ/gvQBGQt/OBnIjX/0Ms9O6bkTTp51CoHCqe hE7Sp8Zy/bftYCxZowu3hmkM37O1LQPLSnpZmvwEd8hnMiiiSIq2f0tfgqecuOSXp4nD eUTbg/Ki2IatwiHQwOdC6NXY+rJsj3lffu+fq43Z/7/F1DNVA1ojomE1msOXPyqJZ0G0 CCog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i5YJcHss20tP7ZQ/brMc62KBT/ftaRdKhsrYV2CBJ6I=; b=lghv0FMp8vmAzUUYiIatX58lWipQb1KltN7ltiD6m4gWLuZJtfzbuM3FbhnQX/6OZr KSdignRVLQHrfhsCD7+BejnkZNrTWCgJQHXoSDWYN2TTZNGZhXaQBNj1wep4YW9V7+b4 WwQE4N4hWlJ3q8qXyl7PUMvy/zM5QYZ4q4/7h2jR+93dDXiWbBoq+L2kl4k6kLFCHa2p RJZgWURenzYf0K8R8JG5gMVoojCohm7ix7V1jB9v4QMnxfCXJ8FF8go/ZGU71+l0G7TG d8JWx1Tiu0XIj59l1OKj7EEFN+PVw4OMSq4lHnq0hQkPBRygojOIIxPYGCY08Uz8Cv0L o0Wg== X-Gm-Message-State: ANhLgQ2QAcBG2OBtBz2Yzq29Frt7FsMroE4AcDM4PxDOdN6fJzVXKFY7 ci3f1qt0k1nO1+WrVH6ITM28WMyF X-Google-Smtp-Source: ADFU+vvfdGuOcOZDqlxkYlx8/Q0fKj/VRiwsjZjCMUB42hN0CiaaBo2Z6GckMCWfHyiAd5588enSKg== X-Received: by 2002:ad4:46d4:: with SMTP id g20mr1634338qvw.179.1585115715753; Tue, 24 Mar 2020 22:55:15 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:15 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 3/8] t5512: stop losing return codes of git commands Date: Wed, 25 Mar 2020 01:54:50 -0400 Message-Id: X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that their failure is reported. Signed-off-by: Denton Liu --- t/t5512-ls-remote.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 62d02152c7..fea64eb5c2 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -21,11 +21,11 @@ test_expect_success setup ' git tag mark1.1 && git tag mark1.2 && git tag mark1.10 && - git show-ref --tags -d | sed -e "s/ / /" >expected.tag && - ( - echo "$(git rev-parse HEAD) HEAD" && - git show-ref -d | sed -e "s/ / /" - ) >expected.all && + git show-ref --tags -d >expected.tag.raw && + sed -e "s/ / /" expected.tag.raw >expected.tag && + generate_references HEAD >expected.all && + git show-ref -d >refs && + sed -e "s/ / /" refs >>expected.all && git remote add self "$(pwd)/.git" ' @@ -173,8 +173,8 @@ do test_config $configsection.hiderefs refs/tags && git ls-remote . >actual && test_unconfig $configsection.hiderefs && - git ls-remote . | - sed -e "/ refs\/tags\//d" >expect && + git ls-remote . >expect.raw && + sed -e "/ refs\/tags\//d" expect.raw >expect && test_cmp expect actual ' From patchwork Wed Mar 25 05:54:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB45817D4 for ; Wed, 25 Mar 2020 05:55:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B59520714 for ; Wed, 25 Mar 2020 05:55:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="umK7k14i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727299AbgCYFzW (ORCPT ); Wed, 25 Mar 2020 01:55:22 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35061 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727262AbgCYFzT (ORCPT ); Wed, 25 Mar 2020 01:55:19 -0400 Received: by mail-qk1-f193.google.com with SMTP id k13so1481960qki.2 for ; Tue, 24 Mar 2020 22:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=16tsqpSGL0Tb9ro7a5KLH7NeNNY+iXVqUAOGFG/7seI=; b=umK7k14imeeusUvnwWtLkk2naodW0GyURWjzT4/tSzD2cwiZOrZEHRWKzmvdaRejnm 8aHjyayL6W0QSQy+MWiFeRaxmfBNO0nKuATC/sHCqrjeRMYOF8RBeS1ca0RKBW7ytkiS T+yv1hk4pRXQPnBBYLMpfVhL9QxdeDQKH7cfn0EaJF1w1hhWzKm0HvNC4GWdG/ND/tP9 B45y1jVJ820kcqSx0LjMoF8fYwGvKDgW4VEedQEqnw90dWpn3HHwOq9weLjd7Vd4I5+a 5VAi3I9fN2pyZXIWOSk6FYhIu6CGNNbLMLeYHuohWa85Jneqg6p0Qv1knKhD/e8NU1L7 3sjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=16tsqpSGL0Tb9ro7a5KLH7NeNNY+iXVqUAOGFG/7seI=; b=KBJPD17szFKD07XFg2L4JggakntPeuqEfveDcgr68B4eSrB4mPuSm5TVw8yFh30KQD Fw7yIDfAmvPBD/Y2yCh2X2PZpDaYRtnFJpXiioNTtCjYzqn6HEbeJu62WCbg8yGwy5QZ 11A++7fD9MHBr9aBSV4mJV5+5h8ZlmJVnxEY+Auce13S/3FzRApwyMg3lBHFMHqsYBNV 2KAB66KZLZ40v6YON7Ee0rK98DYmkqT8GGLao4K/3x7Gdnv4XLt0D4mIt8R2/K0AY/Yy UvMqbtszQaEL0scvpgWZlJ6b5lH6/bQBviuPjH5Jb5opZkLSGpsO7JlDss/YQw06kKKh PxJQ== X-Gm-Message-State: ANhLgQ2shCZHZvYs51+/ewlnBHDatibIQwdEa2yoksSAgHxmYuczPKtJ ZQaHHgE5dbh72E9KR9+xprjV9+io X-Google-Smtp-Source: ADFU+vsxVRJTPt/ly/msEJbSTbw5DUDkOdAdcMjGPTNZtBgJhYz1xZf9E69I+tquYCt3dwAiqF/Piw== X-Received: by 2002:a37:6ca:: with SMTP id 193mr1411745qkg.415.1585115716665; Tue, 24 Mar 2020 22:55:16 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:16 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 4/8] t5550: remove use of `test_might_fail grep` Date: Wed, 25 Mar 2020 01:54:51 -0400 Message-Id: <68c911e29b509d75e390aba573921d6ac385fcaf.1585115341.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Rewrite the use of test_might_fail() with grep to remove this improper usage. Signed-off-by: Denton Liu --- t/t5550-http-fetch-dumb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index b811d89cfd..a06294ad8f 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -248,7 +248,7 @@ test_expect_success 'fetch can handle previously-fetched .idx files' ' ' test_expect_success 'did not use upload-pack service' ' - test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act && + { grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act || :; } && : >exp && test_cmp exp act ' From patchwork Wed Mar 25 05:54:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3787E161F for ; Wed, 25 Mar 2020 05:55:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1865820774 for ; Wed, 25 Mar 2020 05:55:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XLodbNSa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727291AbgCYFzW (ORCPT ); Wed, 25 Mar 2020 01:55:22 -0400 Received: from mail-qv1-f67.google.com ([209.85.219.67]:38741 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbgCYFzS (ORCPT ); Wed, 25 Mar 2020 01:55:18 -0400 Received: by mail-qv1-f67.google.com with SMTP id p60so490531qva.5 for ; Tue, 24 Mar 2020 22:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=F+2j0Idkg1dVglAcEXf/kAgsHx0XXlGCbB639V24EsI=; b=XLodbNSa2/R8V9bI5H5ZBuAWv5DnX8CfK0t8MhXz2DH6gN1ehGGwTWN99BouiCzq5g ANbaJc3OET7b4Iy/xN8/S95sA+QGyN8xxl1pXSFu7pkpEO72PnnIJdTDbYOWkAcsuvi8 1kNhCGXi2KrdqJFF8SaRLyHwg6mASXdVLkkvIImLgqfMLpqdZrjJ9nNVHPhS9OTFSlWV MeQEAv/juUiYLGUqcyTnNqEvJvoBEo1+p/+9Q0T/TrBIj2AeIOPQEhEn/TWqd+t8wE3N Kx/jboswqcrT6ttus8SJLpx2cpbS2xnAD0GxPG6YEdmaJ9RoDU+6Ojk1//HnrFWWI6cl ET5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F+2j0Idkg1dVglAcEXf/kAgsHx0XXlGCbB639V24EsI=; b=hj4ZWBZIiq9yUtEasO0VNheq8YSVyB1hrprTGWzGQV607KyiI5M0Sl3Hp0xREyaBYF /YSGW9gQnbASFQi4jdiIz7AZ00Xo7f8932suVyvM7XP15a8ZS2abIYAW6UW44ME90ebg BdUJTppVxDdflAJ6C5ntdWkfZ71aQtP5z8bKJcp9WEg02M+j5WKgxuRpwTiCtCWT7nJ+ EVkJIuJr7mhq0KHbrqFyR0lYpSFCqYc4MiO0qYDM7WCfLcUlxiVfHY760Adr5Y/tO9d+ iANBDYVs9WgJHZi8bnKie5y6cknpNVC0k4aNaKwDeECgG+y33Y/+FSJqEyL7U0pST7PT lylw== X-Gm-Message-State: ANhLgQ24D9eu3d8nqt2/4NstJIf7RIHqXGEBuLINLLBB1aKsu0Q3rv2M zyiiV6XccB5i51j/bTxjH0WeM1ol X-Google-Smtp-Source: ADFU+vs1sWZbfrJ1+nV9pdmA39a8uCPqtQCDAXImwVjeI2maTF0toan/mB0FmoybirhbDlJs6GqI9w== X-Received: by 2002:ad4:48c7:: with SMTP id v7mr1714816qvx.138.1585115717507; Tue, 24 Mar 2020 22:55:17 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:16 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 5/8] t5607: reorder `nongit test_must_fail` Date: Wed, 25 Mar 2020 01:54:52 -0400 Message-Id: <4253f51feaf47029c1c3389e017d49f2148f03c6.1585115341.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the future, we plan on only allowing `test_must_fail` to work on a restricted subset of commands, including `git`. Reorder the commands so that `nongit` comes before `test_must_fail`. This way, `test_must_fail` operates on a git command. Signed-off-by: Denton Liu --- t/t5607-clone-bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh index 9108ff6fbd..6d5a977fcb 100755 --- a/t/t5607-clone-bundle.sh +++ b/t/t5607-clone-bundle.sh @@ -16,7 +16,7 @@ test_expect_success 'setup' ' test_expect_success '"verify" needs a worktree' ' git bundle create tip.bundle -1 master && - test_must_fail nongit git bundle verify ../tip.bundle 2>err && + nongit test_must_fail git bundle verify ../tip.bundle 2>err && test_i18ngrep "need a repository" err ' From patchwork Wed Mar 25 05:54:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7264917D4 for ; Wed, 25 Mar 2020 05:55:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5498D20774 for ; Wed, 25 Mar 2020 05:55:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aoOVqDGm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbgCYFzV (ORCPT ); Wed, 25 Mar 2020 01:55:21 -0400 Received: from mail-qv1-f67.google.com ([209.85.219.67]:37075 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgCYFzT (ORCPT ); Wed, 25 Mar 2020 01:55:19 -0400 Received: by mail-qv1-f67.google.com with SMTP id n1so494939qvz.4 for ; Tue, 24 Mar 2020 22:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vtqO/4mtDevFWui0LMS2jVUrFypGbKFzLmNnZzqby5I=; b=aoOVqDGm5CmsTtvUAWAS7XFVzmxcT8kOo6m5DOGLDsG2575ivT6NBeFHxdA2jHyZy/ YjQaqXopb0ycNBRJCJeG0ekWb4a3aI1+xLHW+t77Bk6ByeUlQH87SVenXGtcCCHWHno5 o3h8iahxUFzsbxSn9P62OJHITh7i4EWwIo9yPnGbLv/lP+F2DcJ6vT/JYRTrkV1t1TFP D7rSYuhjibfHUlUVBG0zIVnUkJofmUBB0eg76FVMZRovzG0LM80XW9xM1kP0av8q0n/k MxYEbw+IS6uq82paNoXd8+uHPMIqaU8lNwSS9CpE/nUdjE0bmepvM79w+d45XGZ/aHtE ySEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vtqO/4mtDevFWui0LMS2jVUrFypGbKFzLmNnZzqby5I=; b=B1CFzcImvVt/Gkt8IDVHfilXpeyc9q2OCGXZkX1gTlniE3CIAATm0QltsFxzEhqrZU WF7XuwW0kZvDyoVnMG+e3mO7cyJGEdhzwQOspWv3kTOQ5rAt1wrfugaxV6OGCp6yxjmx J5gvD9gHGyq3uRGL5prGoPuyxFVZQeYB3F/WKVLTgKW1/ChnP49nxl/NUATN5RoQRWS8 7GoYB77Y64CBeMxKjib5YyV7o6VhWacnq8FdcSaFzKUkl7uFi3CkriSgilFkO1jMFUeK hQS2n/4jct7ZzDuqEP2zhsMEhCwmyP5rsh9bJMTJDaqCQ4EG5ebU7lFseJCFmQpqsAdP LhqA== X-Gm-Message-State: ANhLgQ1xGjwCKfj/24AT3Y/xeCeBeQSNHkK1bXT4JqBEd/kSLfX+CVFB 3573yHNtbdzEyDzFnpirrsOQhyR9 X-Google-Smtp-Source: ADFU+vtQd40pVFycinpS1HAINncjuoBJ3ewpwBg1VwSlplb1LTzLkv/P8Sb830YruZCLzhElzPnxBw== X-Received: by 2002:a05:6214:11f4:: with SMTP id e20mr1710070qvu.66.1585115718597; Tue, 24 Mar 2020 22:55:18 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:18 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 6/8] t5612: don't use `test_must_fail test_cmp` Date: Wed, 25 Mar 2020 01:54:53 -0400 Message-Id: <2bac5f4a290620ef37e3dcf1e05773acd14cb725.1585115341.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since test_cmp() just wraps an external command, replace `test_must_fail test_cmp` with `! test_cmp`. Signed-off-by: Denton Liu --- t/t5612-clone-refspec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh index e36ac01661..28373e715a 100755 --- a/t/t5612-clone-refspec.sh +++ b/t/t5612-clone-refspec.sh @@ -87,7 +87,7 @@ test_expect_success 'by default no tags will be kept updated' ' git for-each-ref refs/tags >../actual ) && git for-each-ref refs/tags >expect && - test_must_fail test_cmp expect actual && + ! test_cmp expect actual && test_line_count = 2 actual ' From patchwork Wed Mar 25 05:54:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE4EF161F for ; Wed, 25 Mar 2020 05:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE47A2074D for ; Wed, 25 Mar 2020 05:55:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WTkyVvJa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbgCYFzX (ORCPT ); Wed, 25 Mar 2020 01:55:23 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:38003 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727277AbgCYFzV (ORCPT ); Wed, 25 Mar 2020 01:55:21 -0400 Received: by mail-qk1-f196.google.com with SMTP id h14so1462513qke.5 for ; Tue, 24 Mar 2020 22:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NeDa5CkTvwIL8TKIeIyXKu2s+ih1b5I0bD+BmpyqDok=; b=WTkyVvJau6fiOoeaHBk4IpOgd+ieOoioELiz9tEbjrC6V5sTv6ZLncYaRWRZZmft/e TZMg9/A/0M1lwtxCMrNkh+YkNTO2GvB4OMe2aD8Kp2x4OTfsfHG2rwybH/aNpFcOGRqW YhTb6EuY1fKf+07gqQrAAFCIgbXMj3yJmhR4mhMKXMgAzJzYIiPI+u4PecODm6/de82Z ItCkpfs5Vc8X56yFybM9NGrwfziLG8FvfsN3zIkG+t5OrCKWPl+afGdSrMd39B9EYwxS 5pfZpgfwp/eNZ2Czu48yE7zTjuYYF15Q/V0fAIxMwwMxnu/Y95+H+M7JxyLDkDtFZxZb FmJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NeDa5CkTvwIL8TKIeIyXKu2s+ih1b5I0bD+BmpyqDok=; b=bF/N69dGfvYdRgicOIeAJsSBc46wBJuqk5EWnrchzcZmi1MseFdjyqRGAEWGKdif/R +BrCSO4tFN/1xPvDUrF/TSKTPHqrfeb+YoYxCxoFNKDXwjQGdQSfL5D4rvdO5+7Y8eLN DdICFT0kVRMEVqMD7ko1qqSwyxvr9JFe8pruoD0hXJSrsRV7eqOV6eh2F6A5toTbTK1h PpLVbfBgDfb23gVFPqquwgoyJ8kMzbxIXZfJcaTSQeDc9R/+m2rqVSk4JvZp+ZEAajl1 vwkZee3LiIjstWRf6S9tSvtDzmQk/0Iw4fGqGN2AhmnQ0IAXxAyjXUlDjobDyoTKRRq9 VKSg== X-Gm-Message-State: ANhLgQ3K2TpT7Jx+qQlxg/rjkMAPN/nQhtjQfKMmWZx+fgruJ8Ix8F7T AiLi0RMi1ObFMYpaprFFnKiSEbuy X-Google-Smtp-Source: ADFU+vuwZadCLPDw7VcrDa6cLve249RSd+BbpzA77wqcu1zozejNQ7JpWq+Ykrf+Fta8sXRntBYRDg== X-Received: by 2002:a37:bec5:: with SMTP id o188mr1401165qkf.165.1585115719668; Tue, 24 Mar 2020 22:55:19 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:19 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 7/8] t5612: stop losing return codes of git commands Date: Wed, 25 Mar 2020 01:54:54 -0400 Message-Id: X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that their failure is reported. Signed-off-by: Denton Liu --- t/t5612-clone-refspec.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh index 28373e715a..e3b436d8ae 100755 --- a/t/t5612-clone-refspec.sh +++ b/t/t5612-clone-refspec.sh @@ -71,9 +71,9 @@ test_expect_success 'by default all branches will be kept updated' ' ( cd dir_all && git fetch && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # follow both master and side git for-each-ref refs/heads >expect && @@ -104,9 +104,9 @@ test_expect_success '--single-branch while HEAD pointing at master' ' ( cd dir_master && git fetch --force && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # only follow master git for-each-ref refs/heads/master >expect && @@ -126,9 +126,9 @@ test_expect_success '--single-branch while HEAD pointing at master and --no-tags ( cd dir_master_no_tags && git fetch && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # only follow master git for-each-ref refs/heads/master >expect && @@ -156,9 +156,9 @@ test_expect_success '--single-branch while HEAD pointing at side' ' ( cd dir_side && git fetch && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # only follow side git for-each-ref refs/heads/side >expect && @@ -169,9 +169,9 @@ test_expect_success '--single-branch with explicit --branch side' ' ( cd dir_side2 && git fetch && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # only follow side git for-each-ref refs/heads/side >expect && @@ -223,9 +223,9 @@ test_expect_success '--single-branch with detached' ' ( cd dir_detached && git fetch && - git for-each-ref refs/remotes/origin | + git for-each-ref refs/remotes/origin >refs && sed -e "/HEAD$/d" \ - -e "s|/remotes/origin/|/heads/|" >../actual + -e "s|/remotes/origin/|/heads/|" refs >../actual ) && # nothing test_must_be_empty actual From patchwork Wed Mar 25 05:54:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11456977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3697139A for ; Wed, 25 Mar 2020 05:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9434A20774 for ; Wed, 25 Mar 2020 05:55:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MLe2sISw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727320AbgCYFzY (ORCPT ); Wed, 25 Mar 2020 01:55:24 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:33217 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727279AbgCYFzV (ORCPT ); Wed, 25 Mar 2020 01:55:21 -0400 Received: by mail-qv1-f66.google.com with SMTP id p19so506307qve.0 for ; Tue, 24 Mar 2020 22:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=tEtbvB1EO46KaKpHKaeuDGO3cynmYi7A8aQBCxE63jU=; b=MLe2sISw+jUPw/ew0uTWZaDYgyv73sqKW/Nfr7NvIns4cBqoxWLAJ8IBihaAsbHtrP yL6boOL7e/c/XaCXtGC3Di3SVENVok1yx72rWaM81RFtn5UBUrtzGkpav/TwRlwCJaE8 V6GSdTqj+D1+VT7O+LRcWdjM1FygPrNFPdWEF2UarASLyTjghh8+d+kshic9fH+DoG9y zmPSZF18bwQduRPy6dY4B2inYjMDrzKUSSgDY+dXK5P0/pgQ9yvLAPCZWn4KLwsMs3p1 Wy2T00818u1FiLxmeEbo+JTSdZDfcnJgi1KSMMtHOCeXC2WRkmKjilp3Ge8NoDnxjCqm Rcaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tEtbvB1EO46KaKpHKaeuDGO3cynmYi7A8aQBCxE63jU=; b=uHxD5ckgOfi1ZkdIZyhWzqwfVkvvrhKhPtF3hxLxrkPrQ9kyOntijIrAw0InEQIIjo GaGpKnkPSm/1pf1+O4Di0nGuvz6mJNHuBU5DV3mlmYQ09JpZ3Hsx0q0jrecnM1WNnSVc JfkdMQgM7M2+insT42Vm0ULOiCY8GHkJ853wUHZ8CUJ2gLe6FGFSb+sebehNaUsUPLMo dyJ+OIH7lkDRDr/TlGnVAXKRWlmg5DsqnLxhrk9pHwF9uaiRgoJ4eMl/oMTXsOgE02gc +TXx7Ye0lYbBmmn617dx85ij5tpvRWrbQplyMohm/AmnMZsMj65mY6soWYuPHdqkyZwt 2rSQ== X-Gm-Message-State: ANhLgQ0lQ+d8SmeI6RiYdNXChl/k60DL0yI6jJChgBl20LMu/HMEQ+VQ 5qVEcWVtmiwURBsQOeHokufU5f2g X-Google-Smtp-Source: ADFU+vtgoSO8GS2iVtm1aiZiAGh9AMil2Q9zQz77ZAirlaK4ISB/gdLUzUiWKDEmABfBNMvpl2w/MQ== X-Received: by 2002:a05:6214:56c:: with SMTP id cj12mr1657718qvb.29.1585115720515; Tue, 24 Mar 2020 22:55:20 -0700 (PDT) Received: from archbookpro.lan ([199.249.110.29]) by smtp.gmail.com with ESMTPSA id k15sm17168712qta.74.2020.03.24.22.55.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 22:55:19 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH 8/8] t5801: teach compare_refs() to accept ! Date: Wed, 25 Mar 2020 01:54:55 -0400 Message-Id: X-Mailer: git-send-email 2.25.0.114.g5b0ca878e0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, testing if two refs weren't equal with compare_refs() was done with `test_must_fail compare_refs`. This was wrong for two reasons. First, test_must_fail should only be used on git commands. Second, negating the error code is a little heavy-handed since in the case where one of the git invocations within compare_refs() fails, we will report success, even though it failed at an unexpected point. Teach compare_refs() to accept `!` as the first argument which would _only_ negate the test_cmp()'s return code. Signed-off-by: Denton Liu --- t/t5801-remote-helpers.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh index 121e5c6edb..0f04b6cddb 100755 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -11,9 +11,15 @@ test_description='Test remote-helper import and export commands' PATH="$TEST_DIRECTORY/t5801:$PATH" 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_expect_success 'setup repository' ' @@ -189,7 +195,7 @@ test_expect_success GPG 'push signed tag' ' git push origin signed-tag ) && compare_refs local signed-tag^{} server signed-tag^{} && - test_must_fail compare_refs local signed-tag server signed-tag + compare_refs ! local signed-tag server signed-tag ' test_expect_success GPG 'push signed tag with signed-tags capability' '