From patchwork Fri Jul 10 16:47:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Couder X-Patchwork-Id: 11657129 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 5526F14DD for ; Fri, 10 Jul 2020 16:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BA0720767 for ; Fri, 10 Jul 2020 16:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L+zU179F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728215AbgGJQsA (ORCPT ); Fri, 10 Jul 2020 12:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727782AbgGJQr7 (ORCPT ); Fri, 10 Jul 2020 12:47: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 76304C08C5DC for ; Fri, 10 Jul 2020 09:47:59 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id w3so6551317wmi.4 for ; Fri, 10 Jul 2020 09:47: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=molETwuGaszKETlW0HceY5amLv6CUSe98xbvC1vd/mA=; b=L+zU179FZNP2jbE+w4dkrQ4TbhSWgvxHDnJSRHSrPNg6DzE81twY4zy6envlfGugUr PdYJyk9HC93oRN9EdyNzxMApFjbYONFbwvc+eBjqC0DXScJ+ELL4G0ksMsWZfYHZ6433 ndp5g9q9hMMVr8MbQJPPV30cQjRQtNzgAqqe7eXPSkT+z1/cRyx9uzUEt8dJyIVFK14f 3TXI5xrCe2+q5cbK3E30rD++GChKebJ5EtXyKOibDnD2gXJ9EKs1R+ayqvVplvhgFTz+ k+PFsJaY6gtBQeR9rh7RHnngohNZOq8c/CWdLr+8anMe1OuOpiuJgjE64blYVmU3BoC5 wwDw== 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=molETwuGaszKETlW0HceY5amLv6CUSe98xbvC1vd/mA=; b=Rp9vcXUwma60YEQUb9ZU6RLpGaQWR//fKDl67hpFyeUk5JgDgAUFe2kadIIm/UGg3m OH/rjIshC7nlpvyNQbQwBCZT+IuJBhBCvmQV/3TrdbR0J/TunSJSKB9KjZnFZ1Fr31ba tljOXxl1Bm6Hyjr51tteOnYee2dhM2dPwsoHmlI41fZdx/g0Tk/l3Hsts+9+IIf9fGQP fBVJvUduSkJfRgnvqgCgJEjbZv4AYIeCE4BICQn3Cco7JKTSAr7RsHuII3iqyuLSB6Wi ezMsKj+WxBbDZpPJYyPOUAYJcHdiCQrOgrN7TbP5P/CNv6zwGHJNT+8UDBFZD1hE+OTD vp9Q== X-Gm-Message-State: AOAM533breTKs7mLstyaI7hs2grfTctt0+e0ABsxc4MBlmhOrszEjTaM YRo0BFxFrWGVJFtvJj28sRFocX6m85k= X-Google-Smtp-Source: ABdhPJxIAmjakxEE4LmpYU3QcqEQdIgRiy4EuYAHzlnJcfR1EbE1qosJ6C5vSqyBARwtVeEn3kd8nw== X-Received: by 2002:a05:600c:21ca:: with SMTP id x10mr5922424wmj.63.1594399677968; Fri, 10 Jul 2020 09:47:57 -0700 (PDT) Received: from localhost.localdomain ([185.228.229.54]) by smtp.gmail.com with ESMTPSA id m4sm9883385wmi.48.2020.07.10.09.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 09:47:57 -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 v4 1/3] Documentation: clarify %(contents:XXXX) doc Date: Fri, 10 Jul 2020 18:47:37 +0200 Message-Id: <20200710164739.6616-2-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.347.gb620d8b0da In-Reply-To: <20200710164739.6616-1-chriscool@tuxfamily.org> References: <20200707174049.21714-1-chriscool@tuxfamily.org> <20200710164739.6616-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 Fri Jul 10 16:47: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: 11657135 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 436F513B4 for ; Fri, 10 Jul 2020 16:48:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B6A12078B for ; Fri, 10 Jul 2020 16:48:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hSJrVHqF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbgGJQsC (ORCPT ); Fri, 10 Jul 2020 12:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727782AbgGJQsA (ORCPT ); Fri, 10 Jul 2020 12:48:00 -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 A50BEC08C5DC for ; Fri, 10 Jul 2020 09:48:00 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id l2so6564642wmf.0 for ; Fri, 10 Jul 2020 09:48: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=lYrDVd7wyGZYsrhz66x2LRHV4OKXEXPgDl0TkGx8avk=; b=hSJrVHqFFFGjcutOj/q1JtE124ECyVgTbYR7nw54ds83eDrqQHUL07Qb3HT5t5EmpD El0/fEfqGM/pxVnEj0Oa3i/zpDJxEi5mTci7bLu26cnvCRIhMxb6zkHy6cssAl9oRRkV htb8KvkgrRKpWdeHgQ6kOiGbjVD6RDvtvzLZApCINpH2P8XPGdS7OQv3d84moH4/BZwd 6y9n6Ntyr/1HOKxN3AAk3CpT0q2eVu7zSl1x19NV+EUf64oAWQKbiUoUpo7/sEHWLQfI ph9Wm+7oVngm7+skTxwU2ee25iJYdmP7gNG4pooqh99mXwsdyLNpxCj6ZREA/4R29Y2w BnGg== 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=lYrDVd7wyGZYsrhz66x2LRHV4OKXEXPgDl0TkGx8avk=; b=dF2EVWQSAoVzvY5k6bbAkepfmdiJr9/9ZYsYkb0IylGPs67TtzNLK2tvG/7BNIaRpE b8xO4lpeLqUmh1QEHW2NunoQLnSsBHApmYj8/CL30HSnrEbCVsgCMFezG5dDFDuXGcG9 MBtKC20F0P4LcgjBV+R6tnSjOm3SSv6atMCQ+l2JU6lM+aR6ClwydCGxJUBIgn4WDdde N1F2AV4oA6Pf0zUSHec1EkvNs8WYktKrtybb2oKYdImDrqlHyT5YGw3ucgKgC/nCvfNv UhuiVYprNHBWo486+b+W7fdMMdiMtc8GprCaRgiA7IBX/YQaDlTUEMneumU7n+Cml6gy jhNA== X-Gm-Message-State: AOAM533s7c2Ivf4qsjahambsYd/n4qqwxdI7Hu+7vD/vp69oHMcIu7cn aey+xocPPm/YFaAOemNWUrepJBj83hI= X-Google-Smtp-Source: ABdhPJxT/aWrxBtEXPPt1VTIkcg9en1157DAuOwo+kpyKI9QbwHTuh09jNNdO5JMU63e040ImPKsSA== X-Received: by 2002:a7b:c2f7:: with SMTP id e23mr5930656wmk.175.1594399679131; Fri, 10 Jul 2020 09:47:59 -0700 (PDT) Received: from localhost.localdomain ([185.228.229.54]) by smtp.gmail.com with ESMTPSA id m4sm9883385wmi.48.2020.07.10.09.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 09:47:58 -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 v4 2/3] t6300: test refs pointing to tree and blob Date: Fri, 10 Jul 2020 18:47:38 +0200 Message-Id: <20200710164739.6616-3-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.347.gb620d8b0da In-Reply-To: <20200710164739.6616-1-chriscool@tuxfamily.org> References: <20200707174049.21714-1-chriscool@tuxfamily.org> <20200710164739.6616-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 Fri Jul 10 16:47: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: 11657131 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 E2CD013B6 for ; Fri, 10 Jul 2020 16:48:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C93C32078B for ; Fri, 10 Jul 2020 16:48:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BSrrc4NA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728246AbgGJQsD (ORCPT ); Fri, 10 Jul 2020 12:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727906AbgGJQsC (ORCPT ); Fri, 10 Jul 2020 12:48:02 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B873AC08C5DD for ; Fri, 10 Jul 2020 09:48:01 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id a6so6641967wrm.4 for ; Fri, 10 Jul 2020 09:48: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=yOfNiCEUiGkMJyP2oxfjOwrbkswTAeLy23Ep/QVQJEU=; b=BSrrc4NAI/3aCJ/AYqbZopnplquunwIcjvY3jer8PrbM6Rd79jpuKjJk1iVLA8mArn D+69mj5lpKPtChcUHrt265zntSP+O/9jEw0GK4hFFsulJbHQdfQ+1LyFLW1gNfWlgVOQ nN/SGdGKFDLroMcqgvlxaSEbblxB8hMhW0Yt/1HP9ZeGegp9zwfp2C2qW8Da5AOuwkHW uOYl9/Y3dTXcd6w5BzHxQHjGH3p9HHrXflbT8ARP2/LZfXMiWNCNM+lUmtrl8bhsNUML hc/jPyTWo3jYom7R14zRJQd8SMKnpCSuE/k/j3GHGHPCJTLHnuD5AAofThQNhNj6ZYc0 GSMg== 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=yOfNiCEUiGkMJyP2oxfjOwrbkswTAeLy23Ep/QVQJEU=; b=CEsjdZCM1MwMPurcr+w+C/3eVRHMLNysLi2mWDjQQCButL42/TfDcEi2KIHk3inFPU SjRSLaBPre4+n+IiGzxI7EM0k9VNLtZzrJd8BsngllzYN5ddzac+NTxy0u7NvK3o9ESA clCsACRs1MyTcFPFxKhLOXYuSYLb9X/p6ZzPngTFvNJGA+vtSN72ADcScNbZDGl7EGyL PmJhpWJ8vg1h815YX2mGM1umF6PL+P8bb8M4lyxYwOQggmRzXtvQEAwNLxmfdD/4cBI7 qTnKTnz6WTsp9vy7utMbgNPuvbsSeI+S4jVTF6ZUVMkQc/v5bx9exQ+Z7bCBBbxpYLTI YUsA== X-Gm-Message-State: AOAM531zbpsgAXheM3EFbw1qDuEyu0NpPHi6Jdf0a0Yt9l6QCFvwG4M3 Krs8seWLmY5bkVhzVMeh4DRuitT3NUM= X-Google-Smtp-Source: ABdhPJxCbSXhs/CBpUiiPZzprhYuW1BrMSCpsCFFU2/HUWlLe1aeVR7mhrBCRQknzOE1c6Am6jJhOw== X-Received: by 2002:a05:6000:1283:: with SMTP id f3mr69628842wrx.106.1594399680189; Fri, 10 Jul 2020 09:48:00 -0700 (PDT) Received: from localhost.localdomain ([185.228.229.54]) by smtp.gmail.com with ESMTPSA id m4sm9883385wmi.48.2020.07.10.09.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 09:47:59 -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 v4 3/3] ref-filter: add support for %(contents:size) Date: Fri, 10 Jul 2020 18:47:39 +0200 Message-Id: <20200710164739.6616-4-chriscool@tuxfamily.org> X-Mailer: git-send-email 2.27.0.347.gb620d8b0da In-Reply-To: <20200710164739.6616-1-chriscool@tuxfamily.org> References: <20200707174049.21714-1-chriscool@tuxfamily.org> <20200710164739.6616-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..467871ac10 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 "$1" in + refs/tags/signed-*) + # We cannot use $3 as it expects sanitize_pgp to run + expect=$(git cat-file tag $ref | tail -n +6 | wc -c) ;; + refs/mytrees/* | refs/myblobs/*) + expect='' ;; + *) + expect=$(printf '%s' "$3" | wc -c) ;; + esac + # Leave $expect unquoted to lose possible leading whitespaces + echo $expect >expected + test_expect_${4:-success} $PREREQ "basic atom: $1 $2:size" " + git for-each-ref --format='%($2:size)' $ref >actual && + test_cmp expected actual + " + fi } hexlen=$(test_oid hexsz)