Subject: Re: [PATCH v10 11/12] Documentation: add documentation for 'git interpret-trailers'

From: Jeremy Morton <[email-masked]>
Date: Tue, 29 Apr 2014 12:05:41 +0100

On 28/04/2014 17:37, Junio C Hamano wrote:
> Christian Couder<[email-masked]>  writes:
>
>> From: Junio C Hamano<[email-masked]>
>>>
>>> Christian Couder<[email-masked]>  writes:
>>> ...
>>
>>>> +	trailer. After some alphanumeric characters, it can contain
>>>> +	some non alphanumeric characters like ':', '=' or '#' that will
>>>> +	be used instead of ':' to separate the token from the value in
>>>> +	the trailer, though the default ':' is more standard.
>>>
>>> I assume that this is for things like
>>>
>>> 	bug #538
>>>
>>> and the configuration would say something like:
>>>
>>> 	[trailer "bug"]
>>>          	key = "bug #"
>>>
>>> For completeness (of this example), the bog-standard s-o-b would
>>> look like
>>>
>>> 	Signed-off-by: Christian Couder<[email-masked]>
>>>
>>> and the configuration for it that spell the redundant "key" would
>>> be:
>>>
>>> 	[trailer "Signed-off-by"]
>>>          	key = "Signed-off-by: "
>>
>> Yeah, but you can use the following instead:
>>
>>   	[trailer "s-o-b"]
>>           	key = "Signed-off-by: "

One thing I'm not quite understanding is where the "Christian 
Couder<[email-masked]>" bit comes from.  So you've defined the 
trailer token and key, but interpret-trailers then needs to get the 
value it will give for the key from somewhere.  Does it have to just be 
hardcoded in?  We probably want some way to get various variables like 
current branch name, current git version, etc.  So in the case of always 
adding a trailer for the branch that the commit was checked in to at the 
time (Developed-on, Made-on-branch, Author-branch, etc. [I think my 
favourite is Made-on-branch]), you'd want something like:

	[trailer "m-o-b"]
		key = "Made-on-branch: "
		value = "$currentBranch"

... resulting in the trailer (for example):
	Made-on-branch: pacman-minigame

Also, if there were no current branch name because you're committing in 
a detached head state, it would be nice if you could have some logic to 
determine that, and instead write the trailer as:
	Made-on-branch: (detached HEAD: AB12CD34)

... or whatever.  And also how about some logic to be able to say that 
if you're committing to the "master" branch, the trailer doesn't get 
inserted at all?

-- 
Best regards,
Jeremy Morton (Jez)