From patchwork Wed Jul 7 10:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12362349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EC5BC07E9C for ; Wed, 7 Jul 2021 10:21:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 796B461CA8 for ; Wed, 7 Jul 2021 10:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbhGGKYi (ORCPT ); Wed, 7 Jul 2021 06:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbhGGKYh (ORCPT ); Wed, 7 Jul 2021 06:24:37 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14540C06175F for ; Wed, 7 Jul 2021 03:21:57 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n33so1487088wms.1 for ; Wed, 07 Jul 2021 03:21:57 -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=TkOEYabzD3h7VS0ExMAbyQuxQgU50HerE+NhEoacG1M=; b=azMH/KYHOi+08lkqNLBe0LrGilvN4lA8Xc8KcciCPt2hxUkd+tLlxO5boKHmpmfnbY tOxMKHpTKLr+NQZyj8xY4A8+S2PM5FUIA0uMDhJfnbIXByPaqbh9DoPjckqBH7E7/ON5 fF+vM/mO/UhLkDr6khbCV/+9qPltLh3FMab47HmDZZ/zB72votqqy0WkitUDK8yWN4YN PenKwQB7XTYdIx5So2vARsaHeDaqVaW9IlavaNKxAOr88TNxh7SsnW5Yg+sTw5s8zT4V 2nv10VFkZf27HW/fTeSH/nGVW6vzl8flud1sK+PAa2fM6sNnxJygCHdOA95qvSAOjhqy oJ/A== 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=TkOEYabzD3h7VS0ExMAbyQuxQgU50HerE+NhEoacG1M=; b=JryvW5516v/IsNicB6wJQs+zt39+bxkCiGDMOoARZEXTFfoZitcDAU/FuOBBZK7wl5 EdGp7LHKSdVjzkkfqVwI/A8GX4BrasVE90mvmeTJTnB2cRJUwOmDlwhfY68bFYWJr4nk QoU56FtIOPPfbjqbe8bv7gNW2SHL6ueCEvzVPuY29nR8tERF286zKaV5aSbXwqlO7S1k PWLfbzUzYquWWiNdVQm8ZtmTiBCXzBS8YIV/YdjPCh94TDOfbVW9qbjK/mPKyF25pBBe KA4EZJy6+weaxNi27yraREkR/jPW6sYNA6Jsj7owHGkRBHczdg3kjowDxI5DgZOS0Jsr 8aYg== X-Gm-Message-State: AOAM533HRL/9lLB0xhXbC60mtADxLkMesMzkI1y7N+MtT3lk4aVfDf/X W/JKw7UXIUmjihnQglQwO1aLyP1dJovYtA== X-Google-Smtp-Source: ABdhPJzZbV171Q7VmYUH8fRO7FKW1FeGfEZx8bYtirK9NIx60aOo96oE7r6g1rhri9B9DJ4GgSxBEA== X-Received: by 2002:a7b:c092:: with SMTP id r18mr26266309wmh.181.1625653315288; Wed, 07 Jul 2021 03:21:55 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y8sm19701187wrr.76.2021.07.07.03.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 03:21:54 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 1/5] serve tests: add missing "extra delim" test Date: Wed, 7 Jul 2021 12:21:45 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.636.g43e71d69cff In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When the object-info protocol v2 call was added in a2ba162cda2 (object-info: support for retrieving object info, 2021-04-20) we didn't add a corresponding test here. We had tests for ls-refs and fetch already since 4845b772458 (upload-pack: handle unexpected delim packets, 2020-03-27), but the same behavior in object-info (which is clearly copied from the template of "ls-refs") did not have the corresponding tests. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5704-protocol-violations.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/t/t5704-protocol-violations.sh b/t/t5704-protocol-violations.sh index 5c941949b98..95f68e1d4b7 100755 --- a/t/t5704-protocol-violations.sh +++ b/t/t5704-protocol-violations.sh @@ -32,4 +32,21 @@ test_expect_success 'extra delim packet in v2 fetch args' ' test_i18ngrep "expected flush after fetch arguments" err ' +test_expect_success 'extra delim packet in v2 object-info args' ' + # protocol expects 0000 flush after the 0001 + test-tool pkt-line pack >input <<-EOF && + command=object-info + object-format=$(test_oid algo) + 0001 + 0001 + EOF + + cat >err.expect <<-\EOF && + fatal: object-info: expected flush after arguments + EOF + test_must_fail env GIT_PROTOCOL=version=2 \ + git upload-pack . err.actual && + test_cmp err.expect err.actual +' + test_done From patchwork Wed Jul 7 10:21:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12362351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 061DEC07E95 for ; Wed, 7 Jul 2021 10:22:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC41561C9D for ; Wed, 7 Jul 2021 10:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbhGGKYp (ORCPT ); Wed, 7 Jul 2021 06:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbhGGKYj (ORCPT ); Wed, 7 Jul 2021 06:24:39 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19F66C061574 for ; Wed, 7 Jul 2021 03:21:58 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id u8so2412878wrq.8 for ; Wed, 07 Jul 2021 03:21:58 -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=qUr/sWnNygNlAvP4NqEhdrfQfyD1jQt9Zw3BiPYvi6Y=; b=seWpoLSArwp6W4wExzv8+iI6Kw0y2XrRqBN7iK1NbU7QgWcwQFanMautbfMy5gnj+M srv6uwr29fRubNyH+iQygp+pACdwAN+8anGYVR1a8NsWYcEQzIlT0CZDMt2EUCfVqvc2 81EDhVeh3sB9c8zYouP6vyl2xyNEZrgNkdX4ntGtd9oFTg+A1XTxTJ3V6dlbAkuV9Wzy QJq4AMSVU/W4pZz/2QcWyrnryvxxaeNcUM0V/KO6eGBQTTh887HSUIUfXUh+/4DMnO6X yMvBavS34yOIuG6xH71+5XVznIl3d7C8i/9sfO6SsVaejNmS8duPlAA9XHSV2WrSQRWa 4R5Q== 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=qUr/sWnNygNlAvP4NqEhdrfQfyD1jQt9Zw3BiPYvi6Y=; b=lyN4mDAK+ebsdZiXV7fDeBmtWESu1zz2sKnvfV42UdapmRdpl7hjGhWeuPtdgt7ECZ 278G3Mjo77ODkArsqBVsT8omQfVMRZmOU/efDnGqHnvX4QC6VnQoMgD0zs9qsC/yCG9d 25XunNw1rTkf+gVQTIAm+WEbpMUfKq6Rn6//PD3ML+NWxad/6uom2oQFSV7+vFQdQBAC XBy9UC7/jSt2Yy6USLb/Ruby3K8fzecDec5jqfNQYLAYe3RfnzWBQlaTIYD88iuLm+QT 0OCm9KvXgVondUjUgTQd5abR681SvfTNGWswRhPPD9+q98CYZkWCIZCUhBxDIMG7vW8M hQJA== X-Gm-Message-State: AOAM530b4NaAuqISvfHXg12ZC4SToRQJloaYIlPguN+VwogElyaVpEZl udeCku4hsuI69+upBA+L40663I+EKXESUg== X-Google-Smtp-Source: ABdhPJyfU+5MFYiloGA1XMB4aOrWj8fzOD8+QGwJNWE8gZMfgHjNLb44JWvK1PZpDWL5Gg0gxhWJuQ== X-Received: by 2002:a5d:508d:: with SMTP id a13mr20286317wrt.79.1625653316427; Wed, 07 Jul 2021 03:21:56 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y8sm19701187wrr.76.2021.07.07.03.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 03:21:55 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 2/5] serve tests: use test_cmp in "protocol violations" test Date: Wed, 7 Jul 2021 12:21:46 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.636.g43e71d69cff In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Amend the protocol violations tests to check the full output, not just grep it. This changes code added in 4845b772458 (upload-pack: handle unexpected delim packets, 2020-03-27). The newly added test in the preceding commit already did the full test_cmp. I have a related series to tweak the output from upload-pack et al, we really want to make sure we have this exact output, and not fewer or more lines etc. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5704-protocol-violations.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/t/t5704-protocol-violations.sh b/t/t5704-protocol-violations.sh index 95f68e1d4b7..038fffd3d03 100755 --- a/t/t5704-protocol-violations.sh +++ b/t/t5704-protocol-violations.sh @@ -14,9 +14,12 @@ test_expect_success 'extra delim packet in v2 ls-refs args' ' # protocol expects 0000 flush here printf 0001 } >input && + cat >err.expect <<-\EOF && + fatal: expected flush after ls-refs arguments + EOF test_must_fail env GIT_PROTOCOL=version=2 \ - git upload-pack . err && - test_i18ngrep "expected flush after ls-refs arguments" err + git upload-pack . err.actual && + test_cmp err.expect err.actual ' test_expect_success 'extra delim packet in v2 fetch args' ' @@ -27,9 +30,12 @@ test_expect_success 'extra delim packet in v2 fetch args' ' # protocol expects 0000 flush here printf 0001 } >input && + cat >err.expect <<-\EOF && + fatal: expected flush after fetch arguments + EOF test_must_fail env GIT_PROTOCOL=version=2 \ - git upload-pack . err && - test_i18ngrep "expected flush after fetch arguments" err + git upload-pack . err.actual && + test_cmp err.expect err.actual ' test_expect_success 'extra delim packet in v2 object-info args' ' From patchwork Wed Jul 7 10:21:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12362353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A7C9C07E9C for ; Wed, 7 Jul 2021 10:22:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DF4F6008E for ; Wed, 7 Jul 2021 10:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbhGGKYr (ORCPT ); Wed, 7 Jul 2021 06:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhGGKYk (ORCPT ); Wed, 7 Jul 2021 06:24:40 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A6CC06175F for ; Wed, 7 Jul 2021 03:21:59 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id b14-20020a1c1b0e0000b02901fc3a62af78so3799428wmb.3 for ; Wed, 07 Jul 2021 03:21:59 -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=pACzyLj3kTjIRekZbkeovwqwOWB1miQ9TfGaho9IoUU=; b=YXi2jnX3tme3zBLeZPUs7HWxSsrMyx0szM/ROdkzEwWjx/A/vs9PhbL5VU/qKDLNfX aVlO1J9350nfRP8pGKZEy8w1f2HVfmE8olOfCod3AzAd0Xoz2Lr/poyaZRn6bSxcRk95 7nkSkQIkQ0GSI8n6kabwsCrQdfY1czUmUAyQSf8EkJdG4U4qjtrDNxl50A1ROiQZVXSZ 1PKYsX6q3QT4apwA7rJn3xzYxqHk5xNY/DZ8FkJYLSYCNPd3p6KAfYQXtcDx92BGarxM chfnoUm/UjRbceKMqpozrcTrqVvmyBjc4IM50O0VGvstZR2y5KTl+pOOFQNaUn1AX97N KfTA== 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=pACzyLj3kTjIRekZbkeovwqwOWB1miQ9TfGaho9IoUU=; b=fREAXxGiT6qt/lb/l3Fhg1EFUse0o+K4FbMGj/PiQUO9vaU3zPpiSq5B5si89aBHgW G/a4XxlrIiYunxWK+DI/ppNNHcBbl4HpqRJN4RDkdBM3UTtVU3umVl7pxZJ7aYssLMI5 PEjTCeagRItf8JpLdWgUqDYx+U3kTWG7+CcPYB+3Zu5KJLFbot4GCdBhC/1brm4fuJuQ layUFvTGtVEVg7JHO/qdVSJO4rjY232uOV49LTWCSjs6wnN9t77tpVMrCXEfE+lPU/kg 6rdHmBiZ3eM8oAIrcFiFU1KGkEXjpmn4PieHjAMp1JmC2gaOFz/8cbZsM2e+xMOIhT0h Fv6w== X-Gm-Message-State: AOAM533uJOwRrUyf6dDFrq/qV+k+mPC/DPurhbmFkJFR5LWMUQuHV7gW XjBlQEYTJFKOB+ZSS8gtUtPdxn8i/Qpvpg== X-Google-Smtp-Source: ABdhPJxJV7xv3DjDfVcqYxG0H3qoklr9KIlosmEmDlowUC5VVkVQI4rs8hjbnfKEtj8AzOwuRJ+/wQ== X-Received: by 2002:a05:600c:14c6:: with SMTP id i6mr5909269wmh.169.1625653317681; Wed, 07 Jul 2021 03:21:57 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y8sm19701187wrr.76.2021.07.07.03.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 03:21:56 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 3/5] tests: replace [de]packetize() shell+perl test-tool pkt-line Date: Wed, 7 Jul 2021 12:21:47 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.636.g43e71d69cff In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The shell+perl "[de]packetize()" helper functions were added in 4414a150025 (t/lib-git-daemon: add network-protocol helpers, 2018-01-24), and around the same time we added the "pkt-line" helper in 74e70029615 (test-pkt-line: introduce a packet-line test helper, 2018-03-14). For some reason it seems we've mostly used the shell+perl version instead of the helper since then. There were discussions around 88124ab2636 (test-lib-functions: make packetize() more efficient, 2020-03-27) and cacae4329fa (test-lib-functions: simplify packetize() stdin code, 2020-03-29) to improve them and make them more efficient. Let's instead just use the test helper, I think this results in both more legible code, and for anyone who cares about efficiency it'll be faster. We can't convert all the users of packetize(), it has a feature the test-tool is missing. This'll be addressed in the subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5410-receive-pack-alternates.sh | 42 ++++++++++++++++++-------- t/t5411/once-0010-report-status-v1.sh | 8 ++--- t/t5500-fetch-pack.sh | 15 +++++---- t/t5530-upload-pack-error.sh | 24 ++++++++------- t/t5562-http-backend-content-length.sh | 13 ++++---- t/t5570-git-daemon.sh | 12 +++++--- t/t5704-protocol-violations.sh | 30 +++++++++--------- 7 files changed, 86 insertions(+), 58 deletions(-) diff --git a/t/t5410-receive-pack-alternates.sh b/t/t5410-receive-pack-alternates.sh index 0b28e4e452f..d0053d95a44 100755 --- a/t/t5410-receive-pack-alternates.sh +++ b/t/t5410-receive-pack-alternates.sh @@ -16,10 +16,6 @@ test_expect_success 'setup' ' test_commit private ' -extract_haves () { - depacketize | perl -lne '/^(\S+) \.have/ and print $1' -} - test_expect_success 'with core.alternateRefsCommand' ' write_script fork/alternate-refs <<-\EOF && git --git-dir="$1" for-each-ref \ @@ -27,18 +23,40 @@ test_expect_success 'with core.alternateRefsCommand' ' refs/heads/public/ EOF test_config -C fork core.alternateRefsCommand ./alternate-refs && - git rev-parse public/branch >expect && - printf "0000" | git receive-pack fork >actual && - extract_haves actual.haves && - test_cmp expect actual.haves + + test-tool pkt-line pack >in <<-\EOF && + 0000 + EOF + + cat >expect <<-EOF && + $(git rev-parse main) refs/heads/main + $(git rev-parse base) refs/tags/base + $(git rev-parse public) .have + 0000 + EOF + + git receive-pack fork >out actual && + test_cmp expect actual ' test_expect_success 'with core.alternateRefsPrefixes' ' test_config -C fork core.alternateRefsPrefixes "refs/heads/private" && - git rev-parse private/branch >expect && - printf "0000" | git receive-pack fork >actual && - extract_haves actual.haves && - test_cmp expect actual.haves + + test-tool pkt-line pack >in <<-\EOF && + 0000 + EOF + + cat >expect <<-EOF && + $(git rev-parse main) refs/heads/main + $(git rev-parse base) refs/tags/base + $(git rev-parse private) .have + 0000 + EOF + + git receive-pack fork >out actual && + test_cmp expect actual ' test_done diff --git a/t/t5411/once-0010-report-status-v1.sh b/t/t5411/once-0010-report-status-v1.sh index 1233a46eac5..cf33d993192 100644 --- a/t/t5411/once-0010-report-status-v1.sh +++ b/t/t5411/once-0010-report-status-v1.sh @@ -34,13 +34,13 @@ test_expect_success "proc-receive: report status v1" ' $A $B | packetize fi && printf "%s %s refs/for/main/topic1\n" \ - $ZERO_OID $A | packetize && + $ZERO_OID $A | test-tool pkt-line pack && printf "%s %s refs/heads/foo\n" \ - $ZERO_OID $A | packetize && + $ZERO_OID $A | test-tool pkt-line pack && printf "%s %s refs/for/next/topic\n" \ - $ZERO_OID $A | packetize && + $ZERO_OID $A | test-tool pkt-line pack && printf "%s %s refs/for/main/topic2\n" \ - $ZERO_OID $A | packetize && + $ZERO_OID $A | test-tool pkt-line pack && printf 0000 && printf "" | git -C "$upstream" pack-objects --stdout } | git receive-pack "$upstream" --stateless-rpc \ diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 8a5d3492c71..ff0b7dd89f9 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -872,14 +872,17 @@ test_expect_success 'shallow since with commit graph and already-seen commit' ' git commit-graph write --reachable && git config core.commitGraph true && - GIT_PROTOCOL=version=2 git upload-pack . <<-EOF >/dev/null - 0012command=fetch - $(echo "object-format=$(test_oid algo)" | packetize) - 00010013deepen-since 1 - $(echo "want $(git rev-parse other)" | packetize) - $(echo "have $(git rev-parse main)" | packetize) + test-tool pkt-line pack >in <<-EOF && + command=fetch + object-format=$(test_oid algo) + 0001 + deepen-since 1 + want $(git rev-parse other) + have $(git rev-parse main) 0000 EOF + + GIT_PROTOCOL=version=2 git upload-pack . /dev/null ) ' diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh index 7c1460eaa99..8ccaae10475 100755 --- a/t/t5530-upload-pack-error.sh +++ b/t/t5530-upload-pack-error.sh @@ -90,18 +90,20 @@ test_expect_success 'upload-pack fails due to error in pack-objects enumeration' test_expect_success 'upload-pack tolerates EOF just after stateless client wants' ' test_commit initial && - head=$(git rev-parse HEAD) && - - { - packetize "want $head" && - packetize "shallow $head" && - packetize "deepen 1" && - printf "0000" - } >request && - printf "0000" >expect && - - git upload-pack --stateless-rpc . actual && + head=$(git rev-parse HEAD) && + test-tool pkt-line pack >request <<-EOF && + want $head + shallow $head + deepen 1 + 0000 + EOF + + cat >expect <<-\EOF && + 0000 + EOF + git upload-pack --stateless-rpc . out && + test-tool pkt-line unpack actual && test_cmp expect actual ' diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh index e5d3d15ba8d..e6c8338b648 100755 --- a/t/t5562-http-backend-content-length.sh +++ b/t/t5562-http-backend-content-length.sh @@ -53,12 +53,13 @@ test_expect_success 'setup' ' test_commit c1 && hash_head=$(git rev-parse HEAD) && hash_prev=$(git rev-parse HEAD~1) && - { - packetize "want $hash_head" && - printf 0000 && - packetize "have $hash_prev" && - packetize "done" - } >fetch_body && + test-tool pkt-line pack >fetch_body <<-EOF && + want $hash_head + 0000 + have $hash_prev + done + 0000 + EOF test_copy_bytes 10 fetch_body.trunc && hash_next=$(git commit-tree -p HEAD -m next HEAD^{tree}) && { diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh index 82c31ab6cd8..2dde0348816 100755 --- a/t/t5570-git-daemon.sh +++ b/t/t5570-git-daemon.sh @@ -198,12 +198,14 @@ test_expect_success FAKENC 'hostname interpolation works after LF-stripping' ' printf "0000" } >input && fake_nc "$GIT_DAEMON_HOST_PORT" output && - depacketize output.raw && + test-tool pkt-line unpack actual && + + cat >expect <<-EOF && + $(git rev-parse HEAD) HEAD + $(git rev-parse refs/heads/main) refs/heads/main + 0000 + EOF - # just pick out the value of main, which avoids any protocol - # particulars - perl -lne "print \$1 if m{^(\\S+) refs/heads/main}" actual && - git -C "$repo" rev-parse main >expect && test_cmp expect actual ' diff --git a/t/t5704-protocol-violations.sh b/t/t5704-protocol-violations.sh index 038fffd3d03..44e2c0d3ded 100755 --- a/t/t5704-protocol-violations.sh +++ b/t/t5704-protocol-violations.sh @@ -7,13 +7,14 @@ making sure that we do not segfault or otherwise behave badly.' . ./test-lib.sh test_expect_success 'extra delim packet in v2 ls-refs args' ' - { - packetize command=ls-refs && - packetize "object-format=$(test_oid algo)" && - printf 0001 && - # protocol expects 0000 flush here - printf 0001 - } >input && + # protocol expects 0000 flush after the 0001 + test-tool pkt-line pack >input <<-EOF && + command=ls-refs + object-format=$(test_oid algo) + 0001 + 0001 + EOF + cat >err.expect <<-\EOF && fatal: expected flush after ls-refs arguments EOF @@ -23,13 +24,14 @@ test_expect_success 'extra delim packet in v2 ls-refs args' ' ' test_expect_success 'extra delim packet in v2 fetch args' ' - { - packetize command=fetch && - packetize "object-format=$(test_oid algo)" && - printf 0001 && - # protocol expects 0000 flush here - printf 0001 - } >input && + # protocol expects 0000 flush after the 0001 + test-tool pkt-line pack >input <<-EOF && + command=fetch + object-format=$(test_oid algo) + 0001 + 0001 + EOF + cat >err.expect <<-\EOF && fatal: expected flush after fetch arguments EOF From patchwork Wed Jul 7 10:21:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12362355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A437C07E9B for ; Wed, 7 Jul 2021 10:22:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 063C761C9D for ; Wed, 7 Jul 2021 10:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbhGGKYr (ORCPT ); Wed, 7 Jul 2021 06:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbhGGKYk (ORCPT ); Wed, 7 Jul 2021 06:24:40 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDAAC061760 for ; Wed, 7 Jul 2021 03:22:00 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id i2-20020a05600c3542b02902058529ea07so1314476wmq.3 for ; Wed, 07 Jul 2021 03:22:00 -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=3YY1WQBapUW606d/27H4hUlezUCd21kgu2L382vLeJw=; b=sSG0LqzO+UX52cyoSdUmtWRyRcoF2g9hXjlu2sg9M3sUWoHbRTHlHKMoxJ/ErJcypD hld9OGVrUL1Q8DkHZ8/pGDrMExXWe59gnCl4/2KWL7sLSoinhTDu/jB9t0Auq4teaLGr lsxW1nJIdnNM+NxBvgV0sai6Af6Im8Z49QskNX8BCTYZcV1NH8QCzOF3KDnUaWWba3Nc FkQP0FtuV9tBzKsYxO+JSJ8zkzWgd6lIDt8tNTnDx29w+KYgusaXCKheqWke+b9do9cB eS7eQVmNFxWzpS+x0T5soyFHarQx+P4IJ8CgZX3F6gu3cD/MMMOLAomZhiVi6ADvZ624 x78g== 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=3YY1WQBapUW606d/27H4hUlezUCd21kgu2L382vLeJw=; b=lHX0rGAXRVkKrwyNyZVyivzM6pDhYIBM3YfhcoS7eSD5cDNX3vEqthd9jcNSnWjhfH O7E9TqwdZs6Dl6BfUfaoMELT82bz3eKDljj52RKNhtPUcjymrXJrmFkyJpnIbcb3zFZX 5FwnSUcCoW8Ow5fzRX61tyEuz9LZDZB6wxVxvfnbU5wQWiLpfJWjuczBVKm0oCwOlZmP HhqQ2wdwlD/fM2853D0q1b25qi8cEuC8oflZ6r4zMdfUTHoPub9J2IppHDDOJ7FVSt/I fOs9TgQHDcTITjJDSXp17Jwveyy62d6pF/sfE7g/CW/fN3mEFp4jP0iz0tw6DTIUlBd5 +cIg== X-Gm-Message-State: AOAM530+SSM4O+3f09kx+jNLWWFuh0xOBvQx9Cp6g9HBukvJHFvORUYG z6Kf34ZT1Z0LquS5KsWx1woa2V0AiuNIfA== X-Google-Smtp-Source: ABdhPJzDFsyhDH2P6Ou/BEkD4ZsCmmF2SYnUwAWh1mZ7roT+XqOt92qBpqK14QC2ZmY6y131zmtJPA== X-Received: by 2002:a05:600c:2cd2:: with SMTP id l18mr25373081wmc.142.1625653318804; Wed, 07 Jul 2021 03:21:58 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y8sm19701187wrr.76.2021.07.07.03.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 03:21:57 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 4/5] tests: replace remaining packetize() with "test-tool pkt-line" Date: Wed, 7 Jul 2021 12:21:48 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.636.g43e71d69cff In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the only remaining users of "packetize()" over to "test-tool pkt-line", for this we need a new "pack-raw-stdin" subcommand in the test-tool. The "pack" command takes input on stdin, but splits it by "\n", furthermore we'll format the output using C-strings, so the embedded "\0" being tested for here would cause the string to be truncated. So we need another mode that just calls packet_write() on the raw input we got on stdin. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/helper/test-pkt-line.c | 13 +++++++++++++ t/t5411/once-0010-report-status-v1.sh | 4 ++-- t/t5562-http-backend-content-length.sh | 3 ++- t/t5570-git-daemon.sh | 10 ++++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c index 5e638f0b970..a2437fbe57d 100644 --- a/t/helper/test-pkt-line.c +++ b/t/helper/test-pkt-line.c @@ -26,6 +26,17 @@ static void pack(int argc, const char **argv) } } +static void pack_raw_stdin(void) +{ + + struct strbuf sb = STRBUF_INIT; + strbuf_read(&sb, 0, 0); + if (strbuf_read(&sb, 0, 0) < 0) + die_errno("failed to read from stdin"); + packet_write(1, sb.buf, sb.len); + strbuf_release(&sb); +} + static void unpack(void) { struct packet_reader reader; @@ -110,6 +121,8 @@ int cmd__pkt_line(int argc, const char **argv) if (!strcmp(argv[1], "pack")) pack(argc - 2, argv + 2); + else if (!strcmp(argv[1], "pack-raw-stdin")) + pack_raw_stdin(); else if (!strcmp(argv[1], "unpack")) unpack(); else if (!strcmp(argv[1], "unpack-sideband")) diff --git a/t/t5411/once-0010-report-status-v1.sh b/t/t5411/once-0010-report-status-v1.sh index cf33d993192..75d4233e49f 100644 --- a/t/t5411/once-0010-report-status-v1.sh +++ b/t/t5411/once-0010-report-status-v1.sh @@ -28,10 +28,10 @@ test_expect_success "proc-receive: report status v1" ' if test -z "$GIT_DEFAULT_HASH" || test "$GIT_DEFAULT_HASH" = "sha1" then printf "%s %s refs/heads/main\0report-status\n" \ - $A $B | packetize + $A $B | test-tool pkt-line pack-raw-stdin else printf "%s %s refs/heads/main\0report-status object-format=$GIT_DEFAULT_HASH\n" \ - $A $B | packetize + $A $B | test-tool pkt-line pack-raw-stdin fi && printf "%s %s refs/for/main/topic1\n" \ $ZERO_OID $A | test-tool pkt-line pack && diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh index e6c8338b648..23a8a8d5c70 100755 --- a/t/t5562-http-backend-content-length.sh +++ b/t/t5562-http-backend-content-length.sh @@ -64,7 +64,8 @@ test_expect_success 'setup' ' hash_next=$(git commit-tree -p HEAD -m next HEAD^{tree}) && { printf "%s %s refs/heads/newbranch\\0report-status object-format=%s\\n" \ - "$ZERO_OID" "$hash_next" "$(test_oid algo)" | packetize && + "$ZERO_OID" "$hash_next" "$(test_oid algo)" | + test-tool pkt-line pack-raw-stdin && printf 0000 && echo "$hash_next" | git pack-objects --stdout } >push_body && diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh index 2dde0348816..b52afb0cdea 100755 --- a/t/t5570-git-daemon.sh +++ b/t/t5570-git-daemon.sh @@ -193,10 +193,12 @@ test_expect_success 'hostname cannot break out of directory' ' ' test_expect_success FAKENC 'hostname interpolation works after LF-stripping' ' - { - printf "git-upload-pack /interp.git\n\0host=localhost" | packetize - printf "0000" - } >input && + printf "git-upload-pack /interp.git\n\0host=localhost" >has-null && + test-tool pkt-line pack-raw-stdin >input >input <<-\EOF && + 0000 + EOF + fake_nc "$GIT_DAEMON_HOST_PORT" output && test-tool pkt-line unpack actual && From patchwork Wed Jul 7 10:21:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12362357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6767C07E95 for ; Wed, 7 Jul 2021 10:22:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D13A61CA8 for ; Wed, 7 Jul 2021 10:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231364AbhGGKYs (ORCPT ); Wed, 7 Jul 2021 06:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbhGGKYm (ORCPT ); Wed, 7 Jul 2021 06:24:42 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB71DC061764 for ; Wed, 7 Jul 2021 03:22:01 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso2940605wmc.1 for ; Wed, 07 Jul 2021 03:22:01 -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=S/GVjTk3aqpXNzO8A5EMSTIT1hswSeFxGqqYdlv0vKQ=; b=FlLCbZi6usXceudnb87uIUBpb94+vwwWImHTDoqirbPBOKst5MyPABctnQJ02P2KWF dwEU+oRoALflF4XaovWmWoROkiliwxIAjgChbdgGMzlgfPeOXj0KdV3W1lhDnpwOSUKk M+NHzln4aL24nq2f8t3bpTzmolIaYqtsLIQz1kMS97M0CEdYLtzHUhEF05cfM7wWekfs 4E22Y0+qGkX+ygOCc7R15eh3Qr1mHIOG4xObYBWSMPmx6+vVhPEJa0Td1pTqq+LnubxG dUJ49G40ajiQHQIlB1nuO+K69Dn4ov1q3ADLYtMPfo2Hn5V5u6qI5kJCdnoDtCPr8ZEM LveQ== 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=S/GVjTk3aqpXNzO8A5EMSTIT1hswSeFxGqqYdlv0vKQ=; b=ajQibfIbqpxkUpSEB2CDtnT39VTInBY63pK0+GIl4vZu2celBEUHARlkGeRB20ndme IkAbeHneAASDsNfNqrxA2tOmpVA0bu7v75DxmHCg+CO4iAX2Smco4MEDPkcY8dE1n6EA Rer2R4SRQ/nn/Xf3ORRtWscy8dnp+4lUqGteoeZwrU04J/WoPbNkvpaGvKOyzLTzdklY 2esAFF5R8jBrxd0rMKbU0Xa/PW6A05lOfTFOdhRqR0WpusDp3ogQaoPhhHxDbVcnUoBF Pw6/9coyv0rAWdpkuX8uwerQ4j7B4Ya2t9/6W+yPvD6BXOLccDhkhpGNzmGEm/geCm/L VRug== X-Gm-Message-State: AOAM532Tl3BLu8Tfuyei3iFgEjrCPl755vuxtf0YJ+hDR8/57Xlv+qdP TLoFJiCf59opmlE3Ka5yKXVceYYghuK00g== X-Google-Smtp-Source: ABdhPJzFYOTp1CnHhNJBf3rKTVcUCM1Cb1Wx7b64TAIqfeBn7LqdYpEkbzZZ95VucCAxqaD3iIGDpA== X-Received: by 2002:a1c:38c7:: with SMTP id f190mr6056830wma.29.1625653320169; Wed, 07 Jul 2021 03:22:00 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y8sm19701187wrr.76.2021.07.07.03.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 03:21:59 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 5/5] test-lib-functions.sh: remove unused [de]packetize() functions Date: Wed, 7 Jul 2021 12:21:49 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.636.g43e71d69cff In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the now-unused "packetize()" and "depacketize()" functions added in 4414a150025 (t/lib-git-daemon: add network-protocol helpers, 2018-01-24). As discussed in the preceding commits we've now moved all their users over to "test-tool pkt-line". Signed-off-by: Ævar Arnfjörð Bjarmason --- t/test-lib-functions.sh | 42 ----------------------------------------- 1 file changed, 42 deletions(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index f0448daa74b..13971aa4e34 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1453,48 +1453,6 @@ nongit () { ) } 7>&2 2>&4 -# convert function arguments or stdin (if not arguments given) to pktline -# representation. If multiple arguments are given, they are separated by -# whitespace and put in a single packet. Note that data containing NULs must be -# given on stdin, and that empty input becomes an empty packet, not a flush -# packet (for that you can just print 0000 yourself). -packetize () { - if test $# -gt 0 - then - packet="$*" - printf '%04x%s' "$((4 + ${#packet}))" "$packet" - else - perl -e ' - my $packet = do { local $/; }; - printf "%04x%s", 4 + length($packet), $packet; - ' - fi -} - -# Parse the input as a series of pktlines, writing the result to stdout. -# Sideband markers are removed automatically, and the output is routed to -# stderr if appropriate. -# -# NUL bytes are converted to "\\0" for ease of parsing with text tools. -depacketize () { - perl -e ' - while (read(STDIN, $len, 4) == 4) { - if ($len eq "0000") { - print "FLUSH\n"; - } else { - read(STDIN, $buf, hex($len) - 4); - $buf =~ s/\0/\\0/g; - if ($buf =~ s/^[\x2\x3]//) { - print STDERR $buf; - } else { - $buf =~ s/^\x1//; - print $buf; - } - } - } - ' -} - # Converts base-16 data into base-8. The output is given as a sequence of # escaped octals, suitable for consumption by 'printf'. hex2oct () {