Re: [RFC/PATCH 0/2] place cherry pick line below commit title

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Tan <jonathantanmy@xxxxxxxxxx> 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 <token>), 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 <some@xxxxxxx>\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
<ptr,len> or <begin,end> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]