Subject: Re: [PATCH v10 2/2] [GSOC] trailer: add new .cmd config option

From: Junio C Hamano <[email-masked]>
Date: Fri, 16 Apr 2021 20:36:23 -0700

Junio C Hamano <[email-masked]> writes:

> And continuing this line of thought, I think it would be a perfectly
> fine extension to allow the script/program that is launched by the
> .command or .cmd mechanism to signal interpret-trailers that it does
> not want it to add a trailer as the result of this invocation by
> exiting with non-zero.  And that would be a reasonable way forward
> without having to add yet another ugly workaround .runMode.
>
> For example, trailer.signoff.cmd could be this script:
>
> 	#!/bin/sh
> 	if test $# != 1
> 	then
> 		exit 1
> 	else
> 		git log -1 --author="$1" --format='"%aN" <$aE>'
> 	fi
>
> where the "implicit" invocation is signalled by not passing any
> argument, to which the script reacts by exiting with 1, and the
> interpret-trailers would discard the result of the unasked-for
> invocation.

The beauty of this approach, compared to say .runMode, is that the
program specified by .cmd (and .command, except that it cannot tell
if the invocation is in response to explicit --trailer=<key>:<value>
request, or the extra one that is done even without being asked)
have even better control in squelching the trailer output.  Not just
to silence the extra unasked-for invocation, it can inspect the
value given to each of --trailer=<key>:<value> option and decide not
to add a trailer in response to it.