From patchwork Mon Jul 27 20:43:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Perry via GitGitGadget X-Patchwork-Id: 11687555 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 63F4D13B6 for ; Mon, 27 Jul 2020 20:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46D3D20786 for ; Mon, 27 Jul 2020 20:43:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HzgBJUuI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgG0UnN (ORCPT ); Mon, 27 Jul 2020 16:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbgG0UnM (ORCPT ); Mon, 27 Jul 2020 16:43:12 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98565C0619D4 for ; Mon, 27 Jul 2020 13:43:12 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id f1so15625649wro.2 for ; Mon, 27 Jul 2020 13:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=L3UUShb3kGIPQKkEB4fx5bFT1hHTBnr8RIViyS+q8Qc=; b=HzgBJUuIVYIw+qHx4CocK3j7Y8OlQ+/Ie/a3YJrspLnDh9OGCeZsKfkV/Ynr3FUSYr TKFfKzURNIGR1HYf82T37U3MJZNcHo1cfIbUH0UqzFxH8BUNTYIJ1eoQGBcDXqAGS9ih hUAcSroeY19OTcUi22hIQBzmE7NGQdKxeBRL+lFZI7N0jFDS/BZLQBzD3NeS70L3xExX DsQYY7bkT4+YP2iZPLPid3E+6hLpT2ObsqpoxXT7n1L+2ZUvBX+VnWN4GyVqINvkbU77 2kIUGPdrHilv8N6zxQOA6EwTXGJLf5PqQqARGF97EgdhmW3sHeCHAu5hiVh0DGNBzZO1 5mzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=L3UUShb3kGIPQKkEB4fx5bFT1hHTBnr8RIViyS+q8Qc=; b=sbrMjbSo51fJdAw3RmH1wmVlPxINOHWbgCLmDzn8HztoijHsaEKkEwm8aQUbpifaVC VgXLZkxJW1Kmk5cfjU8e+04BWMfoJW4lsgCb453LNF0hx+vSe4aW5jaW3UEyRbG12nqq DfQfKnazwuj7FtpIdcCuOADb1U4R3VWO3gs5KOnic/kU37e4fkCU9VJ987LC3JPhq5An apFxU7+ao1MFQzhTyYpg0dh6XTuacIWLPilFsTwHN9k7W93nWqmSjxpdMopMESLWDfje jimHWdFU3hfcSKEhe0N2QcEYKup+7UTqIMQaiLOalYE38j5v6O8ie3XkrrFaC2K0KTpX pNkQ== X-Gm-Message-State: AOAM531RrjVKhLrQTTXZCe5jrlEtQY2f3VnBcTNgNZ86qMuEg0k9zAUs QMCBsmzlYaeV3L2BkvVAaziAYcRz X-Google-Smtp-Source: ABdhPJzdBTxpIdVbj2rV0pFlPAvGkcf7Y2PWZZGd8nExAcLSrK7KLc0ULLMphLHO1090I6tbeYKvFA== X-Received: by 2002:a5d:54ca:: with SMTP id x10mr14485020wrv.36.1595882591028; Mon, 27 Jul 2020 13:43:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c4sm4925671wrt.41.2020.07.27.13.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:43:10 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Hariom Verma via GitGitGadget" Date: Mon, 27 Jul 2020 20:43:04 +0000 Subject: [PATCH 1/5] ref-filter: support different email formats Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Hariom Verma , Hariom Verma Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Hariom Verma Currently, ref-filter only supports printing email with arrow brackets. Let's add support for two more email options. - trim : print email without arrow brackets. - localpart : prints the part before the @ sign Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma --- ref-filter.c | 36 ++++++++++++++++++++++++++++++++---- t/t6300-for-each-ref.sh | 16 ++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 8447cb09be..8563088eb1 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -102,6 +102,10 @@ static struct ref_to_worktree_map { struct worktree **worktrees; } ref_to_worktree_map; +static struct email_option{ + enum { EO_INVALID, EO_RAW, EO_TRIM, EO_LOCALPART } option; +} email_option; + /* * An atom is a valid field atom listed below, possibly prefixed with * a "*" to denote deref_tag(). @@ -1040,10 +1044,26 @@ static const char *copy_email(const char *buf) const char *eoemail; if (!email) return xstrdup(""); - eoemail = strchr(email, '>'); + switch (email_option.option) { + case EO_RAW: + eoemail = strchr(email, '>') + 1; + break; + case EO_TRIM: + email++; + eoemail = strchr(email, '>'); + break; + case EO_LOCALPART: + email++; + eoemail = strchr(email, '@'); + break; + case EO_INVALID: + default: + return xstrdup(""); + } + if (!eoemail) return xstrdup(""); - return xmemdupz(email, eoemail + 1 - email); + return xmemdupz(email, eoemail - email); } static char *copy_subject(const char *buf, unsigned long len) @@ -1113,7 +1133,7 @@ static void grab_person(const char *who, struct atom_value *val, int deref, void continue; if (name[wholen] != 0 && strcmp(name + wholen, "name") && - strcmp(name + wholen, "email") && + !starts_with(name + wholen, "email") && !starts_with(name + wholen, "date")) continue; if (!wholine) @@ -1124,8 +1144,16 @@ static void grab_person(const char *who, struct atom_value *val, int deref, void v->s = copy_line(wholine); else if (!strcmp(name + wholen, "name")) v->s = copy_name(wholine); - else if (!strcmp(name + wholen, "email")) + else if (starts_with(name + wholen, "email")) { + email_option.option = EO_INVALID; + if (!strcmp(name + wholen, "email")) + email_option.option = EO_RAW; + if (!strcmp(name + wholen, "email:trim")) + email_option.option = EO_TRIM; + if (!strcmp(name + wholen, "email:localpart")) + email_option.option = EO_LOCALPART; v->s = copy_email(wholine); + } else if (starts_with(name + wholen, "date")) grab_date(wholine, v, name); } diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index da59fadc5d..b8a2cb8439 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -106,15 +106,21 @@ test_atom head '*objecttype' '' test_atom head author 'A U Thor 1151968724 +0200' test_atom head authorname 'A U Thor' test_atom head authoremail '' +test_atom head authoremail:trim 'author@example.com' +test_atom head authoremail:localpart 'author' test_atom head authordate 'Tue Jul 4 01:18:44 2006 +0200' test_atom head committer 'C O Mitter 1151968723 +0200' test_atom head committername 'C O Mitter' test_atom head committeremail '' +test_atom head committeremail:trim 'committer@example.com' +test_atom head committeremail:localpart 'committer' test_atom head committerdate 'Tue Jul 4 01:18:43 2006 +0200' test_atom head tag '' test_atom head tagger '' test_atom head taggername '' test_atom head taggeremail '' +test_atom head taggeremail:trim '' +test_atom head taggeremail:localpart '' test_atom head taggerdate '' test_atom head creator 'C O Mitter 1151968723 +0200' test_atom head creatordate 'Tue Jul 4 01:18:43 2006 +0200' @@ -151,15 +157,21 @@ test_atom tag '*objecttype' 'commit' test_atom tag author '' test_atom tag authorname '' test_atom tag authoremail '' +test_atom tag authoremail:trim '' +test_atom tag authoremail:localpart '' test_atom tag authordate '' test_atom tag committer '' test_atom tag committername '' test_atom tag committeremail '' +test_atom tag committeremail:trim '' +test_atom tag committeremail:localpart '' test_atom tag committerdate '' test_atom tag tag 'testtag' test_atom tag tagger 'C O Mitter 1151968725 +0200' test_atom tag taggername 'C O Mitter' test_atom tag taggeremail '' +test_atom tag taggeremail:trim 'committer@example.com' +test_atom tag taggeremail:localpart 'committer' test_atom tag taggerdate 'Tue Jul 4 01:18:45 2006 +0200' test_atom tag creator 'C O Mitter 1151968725 +0200' test_atom tag creatordate 'Tue Jul 4 01:18:45 2006 +0200' @@ -545,10 +557,14 @@ test_atom refs/tags/taggerless tag 'taggerless' test_atom refs/tags/taggerless tagger '' test_atom refs/tags/taggerless taggername '' test_atom refs/tags/taggerless taggeremail '' +test_atom refs/tags/taggerless taggeremail:trim '' +test_atom refs/tags/taggerless taggeremail:localpart '' test_atom refs/tags/taggerless taggerdate '' test_atom refs/tags/taggerless committer '' test_atom refs/tags/taggerless committername '' test_atom refs/tags/taggerless committeremail '' +test_atom refs/tags/taggerless committeremail:trim '' +test_atom refs/tags/taggerless committeremail:localpart '' test_atom refs/tags/taggerless committerdate '' test_atom refs/tags/taggerless subject 'Broken tag' From patchwork Mon Jul 27 20:43:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Perry via GitGitGadget X-Patchwork-Id: 11687557 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 91C66138A for ; Mon, 27 Jul 2020 20:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6822320759 for ; Mon, 27 Jul 2020 20:43:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ghxL8h53" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbgG0UnO (ORCPT ); Mon, 27 Jul 2020 16:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbgG0UnN (ORCPT ); Mon, 27 Jul 2020 16:43:13 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46672C0619D2 for ; Mon, 27 Jul 2020 13:43:13 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id f1so15625674wro.2 for ; Mon, 27 Jul 2020 13:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=S8/R20ozMrlzYGXJXCAiiYXXKdW78PiK95nJRXRiKYY=; b=ghxL8h533G9QIVxN8rh9oxEBLFUWvJ9FKfWrSydhV7uwtRfj/9tFMjY51OOtCZO/2o 1KUEv6lMRAbYwP+919rHSVunWUOstTwHZuA7loMWNEJ2w5wiO5O6SWZfc5+HCJ+93oJF 07DE6x+QjufZoiULV8/FcclOjfI3SpWIiXCOtP1t6VL8nqo/CpzGIwnwLFDdpkLRPLeE i7jvucrjwTtwc2x75DUyUMqy6j4+mTzF5Y1CGiyuwvvjNXUoVLiijKptSt1Q94I4ojVx NlJhoDXiwn8M9EIbwIumulfL560KdbROg81P93gqnsPCze5/Lo8S6CPag7b3p/+YgCEO YNJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=S8/R20ozMrlzYGXJXCAiiYXXKdW78PiK95nJRXRiKYY=; b=FIZ9ngFnMHN+ZKP+X9mD616TqHkvSx+3LCHhdfihg9/SST5KnLuec5eYKNfCRme8tY fV9jAngULcwK9K83RkbSVJBAXurlM6pi0YuwSiIK7dWeXzMHuOYMOvGz1XHigM0TrXoz spLHB6w3iEMJMc4UmIsVin0TNNWHnT2lZgXg37iV/Zn/FsCKAtJ5sqrG/S6BuatP1C7k c0kvEwXK7acBeFiAMXX16LEEXDsPYlyxGWIfFZ1FL6YlxcMnng2KQ3x6TULIFFyW5j2+ HFdrbF7khKM4qM6qpF9PJedLZRmCVvE0vgKdRkZxrrVv7dA4gIxaH8LeMuR520mXym/k mvxQ== X-Gm-Message-State: AOAM531uBbImgPbEM8jEMwb2lf+SLUELqPV1KTddK4wbdUjYDY4VX8qK myJE2ajVTuUGm66R22hTMRRoudIe X-Google-Smtp-Source: ABdhPJy3k6oyahU2GKe8uvT1JJt0aizs8rh0ODZ76ZMqJ4LESDE/zWTH0KohKiSB+4vwcrePwkX5cg== X-Received: by 2002:a5d:65d2:: with SMTP id e18mr21393648wrw.70.1595882591867; Mon, 27 Jul 2020 13:43:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p15sm13073627wrj.61.2020.07.27.13.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:43:11 -0700 (PDT) Message-Id: <49344f1b5559e7b4c63bad323a4dab5956331dde.1595882588.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Hariom Verma via GitGitGadget" Date: Mon, 27 Jul 2020 20:43:05 +0000 Subject: [PATCH 2/5] ref-filter: add `short` option for 'tree' and 'parent' Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Hariom Verma , Hariom Verma Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Hariom Verma Sometimes while using 'parent' and 'tree' atom, user might want to see abbrev hash instead of full 40 character hash. 'objectname' and 'refname' already supports printing abbrev hash. It might be convenient for users to have the same option for printing 'parent' and 'tree' hash. Let's introduce `short` option to 'parent' and 'tree' atom. `tree:short` - for abbrev tree hash `parent:short` - for abbrev parent hash Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma --- ref-filter.c | 12 ++++++++---- t/t6300-for-each-ref.sh | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 8563088eb1..d5d5ff6a9d 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -983,21 +983,25 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object continue; if (deref) name++; - if (!strcmp(name, "tree")) { + if (!strcmp(name, "tree")) v->s = xstrdup(oid_to_hex(get_commit_tree_oid(commit))); - } + else if (!strcmp(name, "tree:short")) + v->s = xstrdup(find_unique_abbrev(get_commit_tree_oid(commit), DEFAULT_ABBREV)); else if (!strcmp(name, "numparent")) { v->value = commit_list_count(commit->parents); v->s = xstrfmt("%lu", (unsigned long)v->value); } - else if (!strcmp(name, "parent")) { + else if (starts_with(name, "parent")) { struct commit_list *parents; struct strbuf s = STRBUF_INIT; for (parents = commit->parents; parents; parents = parents->next) { struct commit *parent = parents->item; if (parents != commit->parents) strbuf_addch(&s, ' '); - strbuf_addstr(&s, oid_to_hex(&parent->object.oid)); + if (!strcmp(name, "parent")) + strbuf_addstr(&s, oid_to_hex(&parent->object.oid)); + else if (!strcmp(name, "parent:short")) + strbuf_add_unique_abbrev(&s, &parent->object.oid, DEFAULT_ABBREV); } v->s = strbuf_detach(&s, NULL); } diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index b8a2cb8439..533827d297 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -97,7 +97,9 @@ test_atom head objectname:short $(git rev-parse --short refs/heads/master) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) test_atom head tree $(git rev-parse refs/heads/master^{tree}) +test_atom head tree:short $(git rev-parse --short refs/heads/master^{tree}) test_atom head parent '' +test_atom head parent:short '' test_atom head numparent 0 test_atom head object '' test_atom head type '' @@ -148,7 +150,9 @@ test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) test_atom tag tree '' +test_atom tag tree:short '' test_atom tag parent '' +test_atom tag parent:short '' test_atom tag numparent '' test_atom tag object $(git rev-parse refs/tags/testtag^0) test_atom tag type 'commit' From patchwork Mon Jul 27 20:43:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Perry via GitGitGadget X-Patchwork-Id: 11687559 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 D934413B6 for ; Mon, 27 Jul 2020 20:43:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C18D32075D for ; Mon, 27 Jul 2020 20:43:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CEqxJ3su" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbgG0UnQ (ORCPT ); Mon, 27 Jul 2020 16:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgG0UnO (ORCPT ); Mon, 27 Jul 2020 16:43:14 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1840FC0619D2 for ; Mon, 27 Jul 2020 13:43:14 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id a15so16158311wrh.10 for ; Mon, 27 Jul 2020 13:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=SvG1GpUTv+SNejtbI1AKIXOTWjCgm3D1aOQc8ZWYtBY=; b=CEqxJ3su2kXxIYHhTFBewjx/MRpQq0qN+cYtW2+rjvt4O98w9WbuPixGqt91aLbYvU 2J58/i59zz9RsgXIgPlHnIcDhk5kTvJ0w01WMJCwUsbqfIaiIvh2oQ5m6CNFqJtr2bd+ dR5KlAGSJl42EKxkPH08YowQmpt60eFMVzoVnrwVUFBP9XJ92+ZENWLxv9xf538OurVi i/iAVKv33S2+ytO4ne92pVrCAVcaIktYcUrLNju84hIJVNd6kDAG1FKstBCy+DYsdRN9 r1apzWlOQVmArPVu6oMTKqQQ7VANayK/PpELk6jvbEoyJwhW5Z/FjQkGIK8jWV8E/DCk 5Opg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=SvG1GpUTv+SNejtbI1AKIXOTWjCgm3D1aOQc8ZWYtBY=; b=dZP/QlV45YbyMdSDUbhollg9VnBBNabRhfVmNfZIdS1f6usEt1CVcTY1RFTXeI3Dr2 5JFDt4SdrsU9bhXXysbATrpzIaTw+QN4ZYUDyuEaxr83Nws4N88RSVqXjMesZlL3LUOJ o9FFD5zgc/W7KyoBBPUHXH5bwf7zcMZqupUdxsRu+JaQ2FSAuzLjylXjWqhWhimENMnN rFbzJjOk8gwfDTJBw/w5+y0lJFMP9tBxI+v0gCqqNbUhScPOnT6JgtPINwJis1Y8iaES b3hWqpiiIhngImdTi53I8sqVMtG24Nb65r6UmywZybAA7sVALPl5g0EZkjD5/ASDTc4y xqvA== X-Gm-Message-State: AOAM533Gm9R7y9tVFCUJiY+nZdrwNqdUYo5T9sEjXqnfKK0mUgL4DfIq vDF63QAEGrSHCc8Rs+Tz1zYhz1wZ X-Google-Smtp-Source: ABdhPJyP+Be3oksQVTG5sY4AADz1UHziT+GYGZuAXVlg6cWGew2JLvy6Wz0hiOyVb5lU6xiUGXvrNQ== X-Received: by 2002:a5d:6646:: with SMTP id f6mr22026713wrw.155.1595882592742; Mon, 27 Jul 2020 13:43:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h10sm14062611wro.57.2020.07.27.13.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:43:12 -0700 (PDT) Message-Id: <69b9d221c01144b72f731a1a8901789929b4e6f9.1595882588.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Hariom Verma via GitGitGadget" Date: Mon, 27 Jul 2020 20:43:06 +0000 Subject: [PATCH 3/5] pretty: refactor `format_sanitized_subject()` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Hariom Verma , Hariom Verma Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Hariom Verma This commit refactors `format_sanitized_subject()` in the hope to use same logic in ref-filter.c Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma --- pretty.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pretty.c b/pretty.c index 2a3d46bf42..8d08e8278a 100644 --- a/pretty.c +++ b/pretty.c @@ -839,24 +839,29 @@ static int istitlechar(char c) (c >= '0' && c <= '9') || c == '.' || c == '_'; } -static void format_sanitized_subject(struct strbuf *sb, const char *msg) +static void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len) { + char *r = xmemdupz(msg, len); size_t trimlen; size_t start_len = sb->len; int space = 2; + int i; - for (; *msg && *msg != '\n'; msg++) { - if (istitlechar(*msg)) { + for (i = 0; i < len; i++) { + if (r[i] == '\n') + r[i] = ' '; + if (istitlechar(r[i])) { if (space == 1) strbuf_addch(sb, '-'); space = 0; - strbuf_addch(sb, *msg); - if (*msg == '.') - while (*(msg+1) == '.') - msg++; + strbuf_addch(sb, r[i]); + if (r[i] == '.') + while (r[i+1] == '.') + i++; } else space |= 1; } + free(r); /* trim any trailing '.' or '-' characters */ trimlen = 0; @@ -1155,7 +1160,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ const struct commit *commit = c->commit; const char *msg = c->message; struct commit_list *p; - const char *arg; + const char *arg, *eol; size_t res; char **slot; @@ -1405,7 +1410,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ format_subject(sb, msg + c->subject_off, " "); return 1; case 'f': /* sanitized subject */ - format_sanitized_subject(sb, msg + c->subject_off); + eol = strchrnul(msg + c->subject_off, '\n'); + format_sanitized_subject(sb, msg + c->subject_off, eol - (msg + c->subject_off)); return 1; case 'b': /* body */ strbuf_addstr(sb, msg + c->body_off); From patchwork Mon Jul 27 20:43:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Perry via GitGitGadget X-Patchwork-Id: 11687561 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 6E00F138A for ; Mon, 27 Jul 2020 20:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54E532075D for ; Mon, 27 Jul 2020 20:43:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BaQw4yPS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726918AbgG0UnR (ORCPT ); Mon, 27 Jul 2020 16:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbgG0UnP (ORCPT ); Mon, 27 Jul 2020 16:43:15 -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 F2047C0619D4 for ; Mon, 27 Jul 2020 13:43:14 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id o8so15299532wmh.4 for ; Mon, 27 Jul 2020 13:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=oOrQOujXNyWnbrMCB1K8NItg5OijsC09i1jMW68z0ZU=; b=BaQw4yPS2lT1MU9OdKJiZ0Cp7Yl1ovRYQp4d8m6v3oMJgfP5xOWO4tQR8mC1W3KSEe XOavZyE1qAMAuVRWbh+TwzXLy3XsQSy3yL94qwZZBNstKdTtRL5mddeIO9WLy62VnaTo o3nn4naXA78wbnAvqJhyn4DiXVr7cbKwpKQ8/pjc6TUZKqAg6F6U7510nYPb+dU4otl2 VctiskjjqkhJIYO1j7mViIBJWYXPc3YRYKXyNOe1fkbO1YcQUuUFh4YkF67AX5+mv2dg DMnb+0P7Xwb40ywxqs2TcJmVSWBvYhVxbSNqSbaRzalnYMTdLKOb1bgNfpJvqxBxAPVw paXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=oOrQOujXNyWnbrMCB1K8NItg5OijsC09i1jMW68z0ZU=; b=V0CTwjdj/uHo8ViABy+43VLb2xAfbxPQX8sJD0L+gSJc/rYZLjtffw8UHb+SqlyNi7 V8EC7CzAorhAoZjN/4RVTe10t6yVMgTPN7lX6PD0e+E5TwgdgBruM1Gzj5GcgOSTxQLH LvSUhPO25rR3guNcecNGuGfq/xlvV9TMgd8kpnI2IDlMP/LnYDeGrvcFQ1ixQaZT2/KG vxHngUTWVpiN8VViYCF/rvJdxDXnjmEFvwKO8/72r+oVS1wGonx4fhghdjivqeCUyu2e ygdmhEV+H/AtEiUl6qgIpGnCbJ7VJlNNIPutgbOndWJTO21BjmocH/VDRZYONq5WWicR ef3g== X-Gm-Message-State: AOAM533djk0tw+EDQUHOBCVO56wdpSvFYFZR3Ya2Ene1AhKG/SnsxMzo spTJCbVYrdtIHgMp4+CpIfG/Ul+I X-Google-Smtp-Source: ABdhPJxrQJfEW1XBCxoBwoLOSqfsNl1pwx2z+I0+lZZYZNrrNq7pKurp1GBqCDOo9OhsN6Efmwiy1A== X-Received: by 2002:a7b:c845:: with SMTP id c5mr907707wml.180.1595882593509; Mon, 27 Jul 2020 13:43:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h14sm903903wml.30.2020.07.27.13.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:43:13 -0700 (PDT) Message-Id: <9dc619b44888024201d9ae1f83a4b34c81fa693f.1595882588.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Hariom Verma via GitGitGadget" Date: Mon, 27 Jul 2020 20:43:07 +0000 Subject: [PATCH 4/5] format-support: move `format_sanitized_subject()` from pretty Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Hariom Verma , Hariom Verma Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Hariom Verma In hope of some new features in `subject` atom, move funtion `format_sanitized_subject()` and all the function it uses to new file format-support.[c/h]. Consider this new file as a common interface between functions that pretty.c and ref-filter.c shares. Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma --- Makefile | 1 + format-support.c | 43 +++++++++++++++++++++++++++++++++++++++++++ format-support.h | 6 ++++++ pretty.c | 40 +--------------------------------------- 4 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 format-support.c create mode 100644 format-support.h diff --git a/Makefile b/Makefile index 372139f1f2..4dfc384b49 100644 --- a/Makefile +++ b/Makefile @@ -882,6 +882,7 @@ LIB_OBJS += exec-cmd.o LIB_OBJS += fetch-negotiator.o LIB_OBJS += fetch-pack.o LIB_OBJS += fmt-merge-msg.o +LIB_OBJS += format-support.o LIB_OBJS += fsck.o LIB_OBJS += fsmonitor.o LIB_OBJS += gettext.o diff --git a/format-support.c b/format-support.c new file mode 100644 index 0000000000..d693aa1744 --- /dev/null +++ b/format-support.c @@ -0,0 +1,43 @@ +#include "diff.h" +#include "log-tree.h" +#include "color.h" +#include "format-support.h" + +static int istitlechar(char c) +{ + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == '.' || c == '_'; +} + +void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len) +{ + char *r = xmemdupz(msg, len); + size_t trimlen; + size_t start_len = sb->len; + int space = 2; + int i; + + for (i = 0; i < len; i++) { + if (r[i] == '\n') + r[i] = ' '; + if (istitlechar(r[i])) { + if (space == 1) + strbuf_addch(sb, '-'); + space = 0; + strbuf_addch(sb, r[i]); + if (r[i] == '.') + while (r[i+1] == '.') + i++; + } else + space |= 1; + } + free(r); + + /* trim any trailing '.' or '-' characters */ + trimlen = 0; + while (sb->len - trimlen > start_len && + (sb->buf[sb->len - 1 - trimlen] == '.' + || sb->buf[sb->len - 1 - trimlen] == '-')) + trimlen++; + strbuf_remove(sb, sb->len - trimlen, trimlen); +} diff --git a/format-support.h b/format-support.h new file mode 100644 index 0000000000..c344ccbc33 --- /dev/null +++ b/format-support.h @@ -0,0 +1,6 @@ +#ifndef FORMAT_SUPPORT_H +#define FORMAT_SUPPORT_H + +void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len); + +#endif /* FORMAT_SUPPORT_H */ diff --git a/pretty.c b/pretty.c index 8d08e8278a..2de01b7115 100644 --- a/pretty.c +++ b/pretty.c @@ -12,6 +12,7 @@ #include "reflog-walk.h" #include "gpg-interface.h" #include "trailer.h" +#include "format-support.h" static char *user_format; static struct cmt_fmt_map { @@ -833,45 +834,6 @@ static void parse_commit_header(struct format_commit_context *context) context->commit_header_parsed = 1; } -static int istitlechar(char c) -{ - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || c == '.' || c == '_'; -} - -static void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len) -{ - char *r = xmemdupz(msg, len); - size_t trimlen; - size_t start_len = sb->len; - int space = 2; - int i; - - for (i = 0; i < len; i++) { - if (r[i] == '\n') - r[i] = ' '; - if (istitlechar(r[i])) { - if (space == 1) - strbuf_addch(sb, '-'); - space = 0; - strbuf_addch(sb, r[i]); - if (r[i] == '.') - while (r[i+1] == '.') - i++; - } else - space |= 1; - } - free(r); - - /* trim any trailing '.' or '-' characters */ - trimlen = 0; - while (sb->len - trimlen > start_len && - (sb->buf[sb->len - 1 - trimlen] == '.' - || sb->buf[sb->len - 1 - trimlen] == '-')) - trimlen++; - strbuf_remove(sb, sb->len - trimlen, trimlen); -} - const char *format_subject(struct strbuf *sb, const char *msg, const char *line_separator) { From patchwork Mon Jul 27 20:43:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Perry via GitGitGadget X-Patchwork-Id: 11687563 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 57760138A for ; Mon, 27 Jul 2020 20:43:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A7D62075D for ; Mon, 27 Jul 2020 20:43:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A7MUv72N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbgG0UnS (ORCPT ); Mon, 27 Jul 2020 16:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgG0UnQ (ORCPT ); Mon, 27 Jul 2020 16:43:16 -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 D8483C0619D2 for ; Mon, 27 Jul 2020 13:43:15 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id x5so14754772wmi.2 for ; Mon, 27 Jul 2020 13:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=OfKJkOAGHL0xEsAIp96Oau+hikHsQClqxiA83+1+DhY=; b=A7MUv72NmBFyms+2D2SJNJCfY2C0tqC2U50IUjuKA2j1nhm0sNpXNMvgJz8Anpctt8 R5ZkNcTdFtw5CirPIhezhiroy/RMgHIP5lTrHrNr7YF33IVhn1m4LBQTpfcQ6HOOAMSM sGOqA+lTjJ6F80DEmcpauGjo/Ewumd1jTZpPbP23E0XBoEtKVRI0/1tNKQLlXflQnKpw psvjkIbpNAZqUeVxa7H3H3kLPlVE+5RmQ6dNwqmdAOvyVmCtI1XZeaC81+Uq+YhesVrW nABM8nxysQtfPFRmvIXyO83rjhPYzQEBwrpyzTCgaWRXbb6zWqHGKPj0uECZ3fmIXmTh SD5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=OfKJkOAGHL0xEsAIp96Oau+hikHsQClqxiA83+1+DhY=; b=gEaifzrLFWfHEux6ZJYETGgtucEGi5JRBAjbpgBLY+JbJKDQt07b/npA7YSo/8DlYB B9nkCcZ1jAe+wvxDLEReIRD8LUOcWWECLpjCrUz/q1b4CCaqF0CdeZdVJQ/jdukpDxP5 io3dqTMEuqMkVzviWsGhuWQ64F6qrfcuzfxrHEBM2lbfD0zOriEjKuyGnu+Jc7F2WQzX yeYu3ci1u1NQzd80WuNRXpHKwcdiHms+2T5U8qzAXaIfcZ2A0WdQjwZGAePBnViLeuLQ f4Qgf2FC4pO9Q/IEdYIyWOncAMIDeZU4o/V5GtN++J2OEWmHki0mhsoQeP7bY5tZ9hib Hsww== X-Gm-Message-State: AOAM532kLkZO7uhCghYif/ZWkP08DYzUlPueUnPjLPxak7spaLKt+hWa RQQqSz5Sl27uXbH0xt9udK9N9sap X-Google-Smtp-Source: ABdhPJxJMQ2HIVK2Gr7fcETnYbjQFf/op/lbHnXKGpT80PYXtWuLyjImpIwypG8c9r9DA27DucHGRg== X-Received: by 2002:a1c:9e0d:: with SMTP id h13mr923276wme.5.1595882594353; Mon, 27 Jul 2020 13:43:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z63sm1154201wmb.2.2020.07.27.13.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:43:13 -0700 (PDT) Message-Id: <7b9103cbadfc111755d2db61239fcac4f4d14a33.1595882588.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Hariom Verma via GitGitGadget" Date: Mon, 27 Jul 2020 20:43:08 +0000 Subject: [PATCH 5/5] ref-filter: add `sanitize` option for 'subject' atom Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Hariom Verma , Hariom Verma Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Hariom Verma Currently, subject does not take any arguments. This commit introduce `sanitize` formatting option to 'subject' atom. `subject:sanitize` - print sanitized subject line, suitable for a filename. Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma --- ref-filter.c | 21 +++++++++++++++++---- t/t6300-for-each-ref.sh | 7 +++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index d5d5ff6a9d..5f8fc65b68 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -23,6 +23,7 @@ #include "worktree.h" #include "hashmap.h" #include "argv-array.h" +#include "format-support.h" static struct ref_msg { const char *gone; @@ -131,7 +132,7 @@ 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_LINES, C_SIG, C_SUB, C_SUB_SANITIZE, C_TRAILERS } option; struct process_trailer_options trailer_opts; unsigned int nlines; } contents; @@ -301,8 +302,14 @@ static int body_atom_parser(const struct ref_format *format, struct used_atom *a static int subject_atom_parser(const struct ref_format *format, struct used_atom *atom, const char *arg, struct strbuf *err) { - if (arg) - return strbuf_addf_ret(err, -1, _("%%(subject) does not take arguments")); + if (arg) { + if (!strcmp(arg, "sanitize")) { + atom->u.contents.option = C_SUB_SANITIZE; + return 0; + } else { + return strbuf_addf_ret(err, -1, _("unrecognized %%(subject) argument: %s"), arg); + } + } atom->u.contents.option = C_SUB; return 0; } @@ -1266,11 +1273,13 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf) struct used_atom *atom = &used_atom[i]; const char *name = atom->name; struct atom_value *v = &val[i]; + if (!!deref != (*name == '*')) continue; if (deref) name++; if (strcmp(name, "subject") && + strcmp(name, "subject:sanitize") && strcmp(name, "body") && !starts_with(name, "trailers") && !starts_with(name, "contents")) @@ -1283,7 +1292,11 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf) if (atom->u.contents.option == C_SUB) v->s = copy_subject(subpos, sublen); - else if (atom->u.contents.option == C_BODY_DEP) + else if (atom->u.contents.option == C_SUB_SANITIZE) { + struct strbuf sb = STRBUF_INIT; + format_sanitized_subject(&sb, subpos, sublen); + v->s = strbuf_detach(&sb, NULL); + } else if (atom->u.contents.option == C_BODY_DEP) v->s = xmemdupz(bodypos, bodylen); else if (atom->u.contents.option == C_BODY) v->s = xmemdupz(bodypos, nonsiglen); diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 533827d297..e2dd410356 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -127,6 +127,7 @@ test_atom head taggerdate '' test_atom head creator 'C O Mitter 1151968723 +0200' test_atom head creatordate 'Tue Jul 4 01:18:43 2006 +0200' test_atom head subject 'Initial' +test_atom head subject:sanitize 'Initial' test_atom head contents:subject 'Initial' test_atom head body '' test_atom head contents:body '' @@ -180,6 +181,7 @@ test_atom tag taggerdate 'Tue Jul 4 01:18:45 2006 +0200' test_atom tag creator 'C O Mitter 1151968725 +0200' test_atom tag creatordate 'Tue Jul 4 01:18:45 2006 +0200' test_atom tag subject 'Tagging at 1151968727' +test_atom tag subject:sanitize 'Tagging-at-1151968727' test_atom tag contents:subject 'Tagging at 1151968727' test_atom tag body '' test_atom tag contents:body '' @@ -592,6 +594,7 @@ test_expect_success 'create tag with subject and body content' ' git tag -F msg subject-body ' test_atom refs/tags/subject-body subject 'the subject line' +test_atom refs/tags/subject-body subject:sanitize 'the-subject-line' test_atom refs/tags/subject-body body 'first body line second body line ' @@ -612,6 +615,7 @@ test_expect_success 'create tag with multiline subject' ' git tag -F msg multiline ' test_atom refs/tags/multiline subject 'first subject line second subject line' +test_atom refs/tags/multiline subject:sanitize 'first-subject-line-second-subject-line' test_atom refs/tags/multiline contents:subject 'first subject line second subject line' test_atom refs/tags/multiline body 'first body line second body line @@ -644,6 +648,7 @@ sig='-----BEGIN PGP SIGNATURE----- PREREQ=GPG test_atom refs/tags/signed-empty subject '' +test_atom refs/tags/signed-empty subject:sanitize '' test_atom refs/tags/signed-empty contents:subject '' test_atom refs/tags/signed-empty body "$sig" test_atom refs/tags/signed-empty contents:body '' @@ -651,6 +656,7 @@ test_atom refs/tags/signed-empty contents:signature "$sig" test_atom refs/tags/signed-empty contents "$sig" test_atom refs/tags/signed-short subject 'subject line' +test_atom refs/tags/signed-short subject:sanitize 'subject-line' test_atom refs/tags/signed-short contents:subject 'subject line' test_atom refs/tags/signed-short body "$sig" test_atom refs/tags/signed-short contents:body '' @@ -659,6 +665,7 @@ test_atom refs/tags/signed-short contents "subject line $sig" test_atom refs/tags/signed-long subject 'subject line' +test_atom refs/tags/signed-long subject:sanitize 'subject-line' test_atom refs/tags/signed-long contents:subject 'subject line' test_atom refs/tags/signed-long body "body contents $sig"