From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7585BC54E94 for ; Wed, 25 Jan 2023 02:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233585AbjAYCYO (ORCPT ); Tue, 24 Jan 2023 21:24:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232712AbjAYCYN (ORCPT ); Tue, 24 Jan 2023 21:24:13 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C48EC53998 for ; Tue, 24 Jan 2023 18:23:47 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id g205so12512041pfb.6 for ; Tue, 24 Jan 2023 18:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=TBFaJTkZzLyRb7RlI/mzXyV5a4GxZ9xfP0gZOYhJDpM=; b=WD3jMXEkz+0Snfw5kGwqk+MYpQBDzXtZw/3jBklVJH0pFstsFgyb/Q060SXtgVtFvW ZPdw8IScnHAmebcClw6JY+o7qgdxMSLKxPozfyi6TAqCs8jdZ3WHsmB6i2spYkRJkBQE myBh/11JY5KHsPKniXhrEtpAP7t2wUB20HcxgrXR1Bc+rrDwE1oSMZz6A4Mvs/iHLnFF YMddZtxVUtuga17fqoTz0TAl2SwDOpBJnHoyFH7KRGK/SSfxJK8cT7hgkTXFnrP8Uy08 Y3f67q8m/x0VsRzVqH2F1PA2+4HkdAZqNX6Kr7tj3kytEFwNmXP+L8Ah1SQ1Rx2t6f+b BDRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:sender:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=TBFaJTkZzLyRb7RlI/mzXyV5a4GxZ9xfP0gZOYhJDpM=; b=riSDFT/Yc2JLcgNuQOOWn7r6LvNIQ3zQIRecP2RMNnWqH2GilE0DWxHtKb5+ZH2x/x MXsyUZy0qaiuFEz9c1eGYQbo2DjMginLaYIBuUHYjOEfV++FHDkHEXsAnWhpIoFloqjX TfA4xA19ZXqb88iqpzVsXvg5A2V7MwfxjRX0RFCRM7uF5LkPDWwEQTEy9HLVeoR33r6k Q0vkk83CTqUdMlJ97wrgKcT0loLIB/Hm5J0bQD2pNCEKrpXikLIudwwczfCbVk0zacAF 7SBAMa+nFAEuVQSzj65kuzM4G8Y+573z6eGsXFpK9rlSqclFOmptWG/GGz9nlkDPyjOx /EIw== X-Gm-Message-State: AFqh2krNFB/hUU6L+BvKtfx12Gq0ijW2wdQq2+W18HVcgU353ny/WEUJ 2L2yKz/ceJSBBLAaPOiVi3M= X-Google-Smtp-Source: AMrXdXte4XRA5nqlb1zCuY7UV5gLNjg+Znrni1q/lezgDEM9J+u8ehbl6ox7x7ci/XxV53VEFkI9xA== X-Received: by 2002:a05:6a00:288c:b0:586:8ead:a8e8 with SMTP id ch12-20020a056a00288c00b005868eada8e8mr32294943pfb.8.1674613415017; Tue, 24 Jan 2023 18:23:35 -0800 (PST) Received: from localhost (137.22.168.34.bc.googleusercontent.com. [34.168.22.137]) by smtp.gmail.com with ESMTPSA id f20-20020a056a0022d400b005877d374069sm2362201pfj.10.2023.01.24.18.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 18:23:34 -0800 (PST) Sender: Junio C Hamano From: Junio C Hamano To: Zev Weiss Cc: git@vger.kernel.org, Emma Brooks , Hamza Mahfooz Subject: Re: [PATCH 4/5] pretty: Add name_and_address_only parameter References: <20230119223858.29262-1-zev@bewilderbeest.net> <20230119223858.29262-5-zev@bewilderbeest.net> Date: Tue, 24 Jan 2023 18:23:34 -0800 In-Reply-To: <20230119223858.29262-5-zev@bewilderbeest.net> (Zev Weiss's message of "Thu, 19 Jan 2023 14:38:57 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Zev Weiss writes: > This is meant to be used with pp_user_info() when using it to format > email recipients generated by --to-cmd/--cc-cmd. When set it omits > the leading 'From: ', trailing linefeed, and the date suffix, and > additionally will return the input string unmodified if > split_ident_line() can't parse it (e.g. for a bare email address). It is somewhat disturbing to see that this only takes effect when cmit_fmt_is_mail(pp->fmt) and completely ignored otherwise. Seeing pp->fmt and pp->name_and_address_only sitting next to each other, it looks like a layering error. I wonder if you instead want a new value for pp->fmt that cmit_fmt_is_mail() considers an e-mail format but is different from what we used for usual e-mail format? > diff --git a/pretty.c b/pretty.c > index 1e1e21878c83..e6798fadc107 100644 > --- a/pretty.c > +++ b/pretty.c > @@ -509,8 +509,11 @@ void pp_user_info(struct pretty_print_context *pp, > return; > > line_end = strchrnul(line, '\n'); > - if (split_ident_line(&ident, line, line_end - line)) > + if (split_ident_line(&ident, line, line_end - line)) { > + if (pp->name_and_address_only) > + strbuf_addstr(sb, line); > return; > + } This error handling is also disturbing. What makes it correct to parrot the original input that does not parse correctly as an ident line to the output, only when name_and_address_only bit is on? It does not make any sense to do so when cmit_fmt_is_mail(pp->fmt) is false, especially.