From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 15A4E1F8C2 for ; Mon, 8 Feb 2021 18:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235628AbhBHSau (ORCPT ); Mon, 8 Feb 2021 13:30:50 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:54986 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235708AbhBHS35 (ORCPT ); Mon, 8 Feb 2021 13:29:57 -0500 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id CE1F411B925; Mon, 8 Feb 2021 13:29:12 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=FcDORtB2bWV3TRQC2NMjrJfqXzs=; b=rAdlAc 0EratP9Tiv9eVa8ty2wFto3ik3l1H+Ek2AEW+6niI48KmbQMy54WbyyNscdYAvEc Lr3eBvYWh77xwr/6D5YnKZBhzTvfJviEtibpCJG7tfZNORS2v5OCVSz6XfK8Dz10 ADFilE+RgHylfgM+u+fk+vy9CWIG/A1wZnXc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=jLxF3dJ6o3tZC5jTdGjHJrCgCGhv5yN0 sFPa5ydz7cFVW803+qI/h0dRrBVKw1XJqcQX2RwiArhUS+3IgcNuH0AmPmENWTd6 Ug5ja0kXvClfmJHD/KZ7aPhlDbvutZvoDwo9c9SI/e+f6WMHJkB6yMfgL3IH6W38 XR3IA+A+J5U= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id C7F1811B924; Mon, 8 Feb 2021 13:29:12 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 1CF3F11B922; Mon, 8 Feb 2021 13:29:10 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: Hariom verma Cc: Hariom Verma via GitGitGadget , git , Christian Couder , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Subject: Re: [PATCH v3 3/3] ref-filter: use pretty.c logic for trailers References: <47d89f872314cad6dc6010ff3c8ade43a70bc540.1612602945.git.gitgitgadget@gmail.com> Date: Mon, 08 Feb 2021 10:29:08 -0800 In-Reply-To: (Hariom verma's message of "Mon, 8 Feb 2021 22:37:38 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 8923179A-6A3B-11EB-A48E-E43E2BB96649-77302942!pb-smtp20.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hariom verma writes: > I suspect that "fix" for "log --pretty" isn't going to work here. > > Even if we apply the same "log --pretty"'s fix here. I think we still > end up having an empty blank line between each ref item. After sleeping on it and seeing a result of an experiment like this one, I think that might be unavoidable. $ git for-each-ref \ --format="One%0a%(trailers:key=Signed-off-by:)Two%0a" \ refs/heads/js/range-diff-wo-dotdot One Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano Two $ exit People who write such "Two" without prefixing it with a newline "%0a" themselves may view such a "fix" a regression. It is sad that this %(trailers) itself is relatively a new thing, and I had thought that all the other ingredients are designed to strip the trailing newline, e.g. try this: $ git for-each-ref \ --format="%(subject)%0a%(trailers:key=Signed-off-by:)" \ refs/heads/js/range-diff-wo-dotdot range-diff(docs): explain how to specify commit ranges Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano Notice that %(subject) is followed explicitly by %0a. I think %(author:date), etc. would do the same. But %(trailers) behave differently, and that is because it expects to be multi-line and perhaps to mimic %(body)? In any case, it may be too late to change its behaviour. At least I do not think of a good waoy to do so. By the way, when merged to 'seen' (you can try the above that shows %(subject) followed by %(trailers) with the tip of 'seen'), it dies like this: $ git for-each-ref \ --format="%(subject)%0a%(trailers:key=Signed-off-by:)" \ refs/heads/js/range-diff-wo-dotdot free(): double free detected in tcache 2 Aborted There must be some interaction with another topic but I didn't dig deeper. Thanks.