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

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

 



"ZheNing Hu via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> +For consistency, the $1 is also passed, this time with the empty string,
> +in the command when the command is first called to add a trailer with
> +the specified <token>.

I guess the same question as 1/2 applies to this part.  I am not
sure what "consistency" the behaviour of calling the configured
command with no argument is trying to achieve.  To me, .cmd doing
this may be for consistency with .command but I am not sure why
the consistency is even desiable.

> +$ cat ~/bin/gcount
> +#!/bin/sh
> +test -n "$1" && git shortlog -s --author="$1" HEAD || true
> +$ git config trailer.cnt.key "Commit-count: "
> +$ git config trailer.cnt.ifExists "replace"
> +$ git config trailer.cnt.cmd "~/bin/gcount"
> +$ git interpret-trailers --trailer="cnt:Junio" <<EOF
> +> subject
> +> 
> +> message
> +> 
> +> EOF
> +subject
> +
> +message
> +
> +Commit-count: 22484     Junio C Hamano
> +------------

This and the other (omitted) example demonstrates how the initial
"empty" invocation is useless by using "replace".  Which also means
that you cannot add more than one trailer of the same <key> with the
mechanism (since the older ones are replaced with the latest).

The code change and the test change are consistent with the design,
though.

Thanks.



[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]

  Powered by Linux