From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 650401F4F8 for ; Wed, 5 Oct 2016 20:33:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754009AbcJEUdT (ORCPT ); Wed, 5 Oct 2016 16:33:19 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:60792 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752869AbcJEUdS (ORCPT ); Wed, 5 Oct 2016 16:33:18 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 1C71D458AE; Wed, 5 Oct 2016 16:33:17 -0400 (EDT) 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=iVC+Q0a+Wnq6BcV6gyuwlLaL4Mk=; b=jB8eW1 09XB6qY2sYThFwO688aeqWq1PHimHqO3UYlReL1pfFJEqd0ND8JbwDKl8in8XOo3 axo19sOPZ7z5crACWgSl7i+cM5RM5J6hwJzjIYHswgg29YvrgUr26mIQjgtmFV+w D6aigbdZ2qhRH3GftiJiaHnKCLZSZ4Cmq/uhI= 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=iRzFXYOAlLxnFSrFSeZx3V6L4FCVDjcR LqtazIRKAcGV1nwfm/IxfHDkAnxIV3MlGD55zEaRJ2YaoAekVXO3LHBJccNV12u8 TBHz15O7wFnx0rQrbljD+I7R+L0KF/N7cilSY0tKbAg6LL8b1Y5S76K8wyQIe70O 4SJsoWGUNNI= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 14034458AD; Wed, 5 Oct 2016 16:33:17 -0400 (EDT) Received: from pobox.com (unknown [104.132.0.95]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 8D0A5458AB; Wed, 5 Oct 2016 16:33:16 -0400 (EDT) From: Junio C Hamano To: Jonathan Tan Cc: git@vger.kernel.org, Christian Couder Subject: Re: [RFC/PATCH 0/2] place cherry pick line below commit title References: <11e41a94-df8c-494a-584b-e2bc8da2de3a@google.com> <84f28caa-2e4b-1231-1a76-3b7e765c0b61@google.com> Date: Wed, 05 Oct 2016 13:33:14 -0700 In-Reply-To: (Jonathan Tan's message of "Wed, 5 Oct 2016 12:38:46 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: F200FAB4-8B3A-11E6-852B-F99D12518317-77302942!pb-smtp1.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Jonathan Tan writes: > Sounds reasonable to me. Would the "[" be a bit of overspecification, > though, since Git doesn't produce it? Also, identifying it as a > garbage line probably wouldn't change any behavior - in the Linux > kernel examples, it is used to show what happened in between > sign-offs, so there will always be one "Signed-off-by:" at the top. Good thinking. As "interpret trailers" cannot locate such a line to manipulate (as it lacks ), we can simply treat it as a garbage line. >> struct { >> const char *whole; >> const char *end_of_message_proper; >> struct { >> const char *token; >> const char *contents; >> } *trailer; >> int alloc_trailers, nr_trailers; >> }; >> >> where >> >> - whole points at the first byte of the input, i.e. the beginning >> of the commit message buffer. >> >> - end-of-message-proper points at the first byte of the trailer >> block into the buffer at "whole". >> >> - token is a canonical header name for easy comparison for >> interpret-trailers (you can use NULL for garbage lines, and made >> up token like "[bracket]" and "(cherrypick)" that would not clash >> with real tokens like "Signed-off-by"). >> >> - contents is the bytes on the logical line, including the header >> part >> >> E.g. an element in trailer[] array may say >> >> { >> .token = "Signed-off-by", >> .contents = "Signed-Off-By: Some Body \n", >> } > > I get the impression from the rest of your e-mail that no strings are > meant to be copied - is that true? (That sounds like a good idea to > me.) I was envisioning that "whole", "end-of-message" can point into the input buffer, while trailer[].contents may have to be copied, if only to make it to a NUL-terminated string. But I am fine with or pair to avoid copying .contents if that is desired. You'd need to worry about differentiating .contents that need to be freed after "interpret trailers" inserted a new entry or replaced the contents, though.