From patchwork Thu Jul 16 12:19:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Couder X-Patchwork-Id: 11667265 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 85BD260D for ; Thu, 16 Jul 2020 12:19:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CAEE207BC for ; Thu, 16 Jul 2020 12:19:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FogAZ1b9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728497AbgGPMT5 (ORCPT ); Thu, 16 Jul 2020 08:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728093AbgGPMT4 (ORCPT ); Thu, 16 Jul 2020 08:19:56 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62616C061755 for ; Thu, 16 Jul 2020 05:19:56 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id f18so11388236wml.3 for ; Thu, 16 Jul 2020 05:19:56 -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=xc0Dsv5lB7H0CaX1mN5VKlas2vXO+F2kanTBCL8drGQ=; b=FogAZ1b9m+za37hk+gi2MWnUmwr2ztsW38EZvp5Vd4sdrYEE6tvUB7ysR/WoF8ApwY sa5/SNeKpw2oMPNYNoTN3MV+/p0+8dH8PUL05jKzthD+UzjsvK7KlxUasndYfQ9vMypN BvuVLHatom00s6sny0WQng6ElPW4U7pElGnleFr28OaFCOPJyRe+cGaQWPcS2XQhl9DD CI3U6UKx2pjty5qOC9ALSVGnMr+os30UzFK7IpEvgzgzNwzn5ypm/yR6EDstpBwDCsKx 8pHvK5ZNc/4szKoufKg5CBW7g7HU5oH23e48u/a6uWAEphEHUCYaW0fVlZvaV7luwF7M xDGg== 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=xc0Dsv5lB7H0CaX1mN5VKlas2vXO+F2kanTBCL8drGQ=; b=WjYp9gedq28eJLl/Tibmdn2zNCm+aYgFYSP9ktXqZrYpP4OQAY8x2HjWkZbN0/BICn k1dyF2N96UFSj3ErCuWk/K0+gjyY9d/ZKgz3V7bGJ28qrCyCzT22MzA3bLdqtMiNkMEB d5RTHDgEIiSoPbUwGv5gawgV3aQi02Ei9wal3bfphGEewlwQpzmz43uWY/7+CO0QsdvT L40QVXhWwdmRlSsVElXveeelK8/YyXK5uvg/TQIYt/BohYsgE/UuGrvqsfTpJHP/roUa pd20ZV/arHw6wKFLx/H4GoQX+ukQeyvR8DrVuq7zkeoZvAuTRjccXJbNFE/qFJ2jeGmM I3vQ== X-Gm-Message-State: AOAM531tIOcISFPMyngnNOST+t2TRXcDjEUqLQiOjd8CWdZnJ6rZErhm HhjVo/2IKVLf755NtDNjF9g8XtsJ5UU= X-Google-Smtp-Source: ABdhPJyG7gvlZ6/UHaauL1dujitBlsF/Z64guMHVp2qmwWEllE+ENP6yCW6tI5RtFKppKGG94cF1ow== X-Received: by 2002:a05:600c:258:: with SMTP id 24mr4286094wmj.126.1594901994637; Thu, 16 Jul 2020 05:19:54 -0700 (PDT) Received: from localhost.localdomain ([193.56.245.81]) by smtp.gmail.com with ESMTPSA id p4sm8725714wrx.63.2020.07.16.05.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 05:19:53 -0700 (PDT) From: Christian Couder X-Google-Original-From: Christian Couder To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Christian Couder Subject: [PATCH v5 1/3] Documentation: clarify %(contents:XXXX) doc Date: Thu, 16 Jul 2020 14:19:38 +0200 Message-Id: <20200716121940.21041-2-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.227.g757ac19d14.dirty In-Reply-To: <20200716121940.21041-1-chriscool@tuxfamily.org> References: <20200710164739.6616-1-chriscool@tuxfamily.org> <20200716121940.21041-1-chriscool@tuxfamily.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Let's avoid a big dense paragraph by using an unordered list for the %(contents:XXXX) format specifiers. While at it let's also make the following improvements: - Let's not describe %(contents) using "complete message" as it's not clear what an incomplete message is. - Let's improve how the "subject" and "body" are described. - Let's state that "signature" is only available for tag objects. Suggested-by: Jeff King Signed-off-by: Christian Couder --- Documentation/git-for-each-ref.txt | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 6dcd39f6f6..b739412c30 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -232,12 +232,24 @@ Fields that have name-email-date tuple as its value (`author`, `committer`, and `tagger`) can be suffixed with `name`, `email`, and `date` to extract the named component. -The complete message in a commit and tag object is `contents`. -Its first line is `contents:subject`, where subject is the concatenation -of all lines of the commit message up to the first blank line. The next -line is `contents:body`, where body is all of the lines after the first -blank line. The optional GPG signature is `contents:signature`. The -first `N` lines of the message is obtained using `contents:lines=N`. +The message in a commit or a tag object is `contents`, from which +`contents:` can be used to extract various parts out of: + +contents:subject:: + The first paragraph of the message, which typically is a + single line, is taken as the "subject" of the commit or the + tag message. + +contents:body:: + The remainder of the commit or the tag message that follows + the "subject". + +contents:signature:: + The optional GPG signature of the tag. + +contents:lines=N:: + The first `N` lines of the message. + Additionally, the trailers as interpreted by linkgit:git-interpret-trailers[1] are obtained as `trailers` (or by using the historical alias `contents:trailers`). Non-trailer lines from the trailer block can be omitted From patchwork Thu Jul 16 12:19:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Couder X-Patchwork-Id: 11667267 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 C66B313B6 for ; Thu, 16 Jul 2020 12:20:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD65D207BB for ; Thu, 16 Jul 2020 12:20:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lsVWOiWX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728516AbgGPMT7 (ORCPT ); Thu, 16 Jul 2020 08:19:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728093AbgGPMT5 (ORCPT ); Thu, 16 Jul 2020 08:19:57 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7526CC061755 for ; Thu, 16 Jul 2020 05:19:57 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 22so10099651wmg.1 for ; Thu, 16 Jul 2020 05:19: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=69Bh3UP7bjekPz5dao8yczDgOXMyxuhA/pe6g5dmdOA=; b=lsVWOiWXiRrLQduR6Y/ly2iUCqqAcrV6UfujrZ4Ghyx5RaAfQ/WPZY4jacS4R4Fg15 BG5O5kmq/X61luIs2RPly/WP/XhDxKa0DJdIL43Zey6yGhJFxAwV0yFfpRX1UMBsEzm1 HuBwN/tmfYzleFhSSQDRVuMhHpsR67U4+vWf0sWGkJVTuhpZNHvvMg13SOdZ7NQMGrM3 uktzsy9BV0M74czi+UZ4a9nwMtEXlJ3TuOOBxbOX1THMg3cOMYywlla8qhCpWNtbuBLb YmMP2dmdUxQixLN7GGd7rdXkyuVIw0Od48R7Lhloe5vAc1f30T4tsvq8CIlQTvglggsZ iebA== 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=69Bh3UP7bjekPz5dao8yczDgOXMyxuhA/pe6g5dmdOA=; b=Yws6gdZjGECx+PI8Qve3JFdlHAtl0NehGWzdQ9Hg5K2l2aAEzvB/3N14RHkrTQNbNR /GT8LWC3kOJ2NzCfxnUBGcYl7F5U2xIpvoxfTP9kmcMKyZmlRkMKYYPkjb6QPDNBDusp Q+uxwRTu+107+0cOgC36wrAXwsq3TN6snHVGkv3pUVvesJgGsJTaDSHRfSmg/4VcDe7T F4CyVcGeu9cB9NApUk2rkq6U4R5dzwpprpFLUg0TdvBrJp3//xUfa/wcERjiljKRI/Le 9T8dyaNL/wE96cDRTdGVnZnwvuI5X5L8NatycAcOgWgey4Z08OGp1V50pZlWpXnSktj/ Ez5Q== X-Gm-Message-State: AOAM533nKHSMGyD+4rgW1O+lBvJ5XFjINsvMx7xS7c7EC/JMKSIVWCPB pT62xWB6ZK8Af5FrJi1S3pLXGZw0BfM= X-Google-Smtp-Source: ABdhPJxfqlLxluUN1VZQBSPVC1WI7s4MLCvWrHWpyYOqYgaiJAaNPtg/p8EXgnPqTjXpm2vOlywNRQ== X-Received: by 2002:a7b:c921:: with SMTP id h1mr3885167wml.29.1594901995852; Thu, 16 Jul 2020 05:19:55 -0700 (PDT) Received: from localhost.localdomain ([193.56.245.81]) by smtp.gmail.com with ESMTPSA id p4sm8725714wrx.63.2020.07.16.05.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 05:19:55 -0700 (PDT) From: Christian Couder X-Google-Original-From: Christian Couder To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Christian Couder Subject: [PATCH v5 2/3] t6300: test refs pointing to tree and blob Date: Thu, 16 Jul 2020 14:19:39 +0200 Message-Id: <20200716121940.21041-3-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.227.g757ac19d14.dirty In-Reply-To: <20200716121940.21041-1-chriscool@tuxfamily.org> References: <20200710164739.6616-1-chriscool@tuxfamily.org> <20200716121940.21041-1-chriscool@tuxfamily.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Adding tests for refs pointing to tree and blob shows that we care about testing both positive ("see, my shiny new toy does work") and negative ("and it won't do nonsensical things when given an input it is not designed to work with") cases. Signed-off-by: Christian Couder --- t/t6300-for-each-ref.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index da59fadc5d..e9f468d360 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -650,6 +650,25 @@ test_atom refs/tags/signed-long contents "subject line body contents $sig" +test_expect_success 'set up refs pointing to tree and blob' ' + git update-ref refs/mytrees/first refs/heads/master^{tree} && + git update-ref refs/myblobs/first refs/heads/master:one +' + +test_atom refs/mytrees/first subject "" +test_atom refs/mytrees/first contents:subject "" +test_atom refs/mytrees/first body "" +test_atom refs/mytrees/first contents:body "" +test_atom refs/mytrees/first contents:signature "" +test_atom refs/mytrees/first contents "" + +test_atom refs/myblobs/first subject "" +test_atom refs/myblobs/first contents:subject "" +test_atom refs/myblobs/first body "" +test_atom refs/myblobs/first contents:body "" +test_atom refs/myblobs/first contents:signature "" +test_atom refs/myblobs/first contents "" + test_expect_success 'set up multiple-sort tags' ' for when in 100000 200000 do From patchwork Thu Jul 16 12:19:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Couder X-Patchwork-Id: 11667269 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 64B9D722 for ; Thu, 16 Jul 2020 12:20:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49E0320739 for ; Thu, 16 Jul 2020 12:20:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iEf6u9oe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728519AbgGPMUB (ORCPT ); Thu, 16 Jul 2020 08:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728505AbgGPMT7 (ORCPT ); Thu, 16 Jul 2020 08:19:59 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86B0C061755 for ; Thu, 16 Jul 2020 05:19:58 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id f139so11403526wmf.5 for ; Thu, 16 Jul 2020 05:19: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=/Zg2UiL1Ak6FSljSAmukkuuTIGXOWEdFSYWYhmR/sXo=; b=iEf6u9oeLfxdAtshAx4MN2X9Fl45eBmUUa0IY0W0s5M7/l6HuA8e91oEfPRTIS8QO6 yG5mCDQrMIQNrAENrPc0pMqz0uRNBejpsH9ADDIJYSHlGsXOwQ+ey6RFDUmL8UlOT+mq oFDVs2wJM7k4MZHIZUw7HpnBwPtYGLqISbzjhsoL/lHXxfdr7GsagmSsWub+4Cpd/N/P vYBHLWATd/Li541/0kxdfAUOhlabQldtLjIKnUPX09dznszL+MMl3Ggrrc3+z/6s1wwK wpLJuTMbetNdWG1OzHGhGAcBcLeRcVXMsCBI3ty9USWtsD+Sk5czgvwr505c2qbIgtq2 SK9g== 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=/Zg2UiL1Ak6FSljSAmukkuuTIGXOWEdFSYWYhmR/sXo=; b=E4G1rB1ZtzHDTotR3lcl8IzQIWY0hHgGcdYch60f/BGV3zDPLLSTlRkOKMWOeq4MVS OUPS9ERKcG7XUT7dfSEYjU7W8USQbWZS9jyofDfjJC00A3Ef6reu25nqdJ/nJHx1kswx 5u0kbwEEvcvh0l0k4RNTHDfUE3JpH/RijWWSlOY3JILgWNZGIrhng5TlPzIutM/VEqBZ 3dJnjuqGXKeUpNrKrhWoXQU6xhtv7P64Ww2BIiQFLU/+GSLCs+0d9s55fnsRt++qVGQ/ 3P+8uFzdGjpa7oroIS3cL31LP4md1++Xud16jAPGXNZH/wImn9/nmdp7+KIcRdFjGuQu a+cw== X-Gm-Message-State: AOAM533gRlrOh5P/SYqZVnFijbiJIcW4B9LK09RLvvD81mhUpJQsG2/U nJzXxZwaUnJ6MVoytc6xh6fYm36Ky5U= X-Google-Smtp-Source: ABdhPJykBIySHmjkRcNbzM/5ieOUHH4kp4peL3lwDFEoKoK2VuIqE4s48UzbMZZLvCVxi83ZYcQsVQ== X-Received: by 2002:a1c:2dc6:: with SMTP id t189mr4361822wmt.26.1594901997104; Thu, 16 Jul 2020 05:19:57 -0700 (PDT) Received: from localhost.localdomain ([193.56.245.81]) by smtp.gmail.com with ESMTPSA id p4sm8725714wrx.63.2020.07.16.05.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 05:19:56 -0700 (PDT) From: Christian Couder X-Google-Original-From: Christian Couder To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Christian Couder Subject: [PATCH v5 3/3] ref-filter: add support for %(contents:size) Date: Thu, 16 Jul 2020 14:19:40 +0200 Message-Id: <20200716121940.21041-4-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.227.g757ac19d14.dirty In-Reply-To: <20200716121940.21041-1-chriscool@tuxfamily.org> References: <20200710164739.6616-1-chriscool@tuxfamily.org> <20200716121940.21041-1-chriscool@tuxfamily.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It's useful and efficient to be able to get the size of the contents directly without having to pipe through `wc -c`. Also the result of the following: `git for-each-ref --format='%(contents)' refs/heads/my-branch | wc -c` is off by one as `git for-each-ref` appends a newline character after the contents, which can be seen by comparing its output with the output from `git cat-file`. As with %(contents), %(contents:size) is silently ignored, if a ref points to something other than a commit or a tag: ``` $ git update-ref refs/mytrees/first HEAD^{tree} $ git for-each-ref --format='%(contents)' refs/mytrees/first $ git for-each-ref --format='%(contents:size)' refs/mytrees/first ``` Signed-off-by: Christian Couder --- Documentation/git-for-each-ref.txt | 3 +++ ref-filter.c | 7 ++++++- t/t6300-for-each-ref.sh | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index b739412c30..2ea71c5f6c 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -235,6 +235,9 @@ and `date` to extract the named component. The message in a commit or a tag object is `contents`, from which `contents:` can be used to extract various parts out of: +contents:size:: + The size in bytes of the commit or tag message. + contents:subject:: The first paragraph of the message, which typically is a single line, is taken as the "subject" of the commit or the diff --git a/ref-filter.c b/ref-filter.c index 8447cb09be..73d8bfa86d 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -127,7 +127,8 @@ static struct used_atom { unsigned int nobracket : 1, push : 1, push_remote : 1; } remote_ref; struct { - enum { C_BARE, C_BODY, C_BODY_DEP, C_LINES, C_SIG, C_SUB, C_TRAILERS } option; + enum { C_BARE, C_BODY, C_BODY_DEP, C_LENGTH, + C_LINES, C_SIG, C_SUB, C_TRAILERS } option; struct process_trailer_options trailer_opts; unsigned int nlines; } contents; @@ -338,6 +339,8 @@ static int contents_atom_parser(const struct ref_format *format, struct used_ato atom->u.contents.option = C_BARE; else if (!strcmp(arg, "body")) atom->u.contents.option = C_BODY; + else if (!strcmp(arg, "size")) + atom->u.contents.option = C_LENGTH; else if (!strcmp(arg, "signature")) atom->u.contents.option = C_SIG; else if (!strcmp(arg, "subject")) @@ -1253,6 +1256,8 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf) v->s = copy_subject(subpos, sublen); else if (atom->u.contents.option == C_BODY_DEP) v->s = xmemdupz(bodypos, bodylen); + else if (atom->u.contents.option == C_LENGTH) + v->s = xstrfmt("%"PRIuMAX, (uintmax_t)strlen(subpos)); else if (atom->u.contents.option == C_BODY) v->s = xmemdupz(bodypos, nonsiglen); else if (atom->u.contents.option == C_SIG) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index e9f468d360..ea9bb6dade 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -52,6 +52,25 @@ test_atom() { sanitize_pgp actual.clean && test_cmp expected actual.clean " + # Automatically test "contents:size" atom after testing "contents" + if test "$2" = "contents" + then + case $(git cat-file -t "$ref") in + tag) + # We cannot use $3 as it expects sanitize_pgp to run + expect=$(git cat-file tag $ref | tail -n +6 | wc -c) ;; + tree | blob) + expect='' ;; + commit) + expect=$(printf '%s' "$3" | wc -c) ;; + esac + # Leave $expect unquoted to lose possible leading whitespaces + echo $expect >expected + test_expect_${4:-sucess} $PREREQ "basic atom: $1 contents:size" ' + git for-each-ref --format="%(contents:size)" "$ref" >actual && + test_cmp expect actual + ' + fi } hexlen=$(test_oid hexsz)