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

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

 



Junio C Hamano <gitster@xxxxxxxxx> 于2021年4月22日周四 上午7:40写道:
>
> ZheNing Hu <adlternative@xxxxxxxxx> writes:
>
> > I admit that your idea makes sense, but we actually have another requirement:
> > Construct a trailer with an empty value.
>
> It can be done with a different script given to .cmd, which would
> say "exit 0" when allowing an empty string given as its input to
> appear in the output.
>

Now I think that we should keep those trailers which ask for a
"name <email>" pair, like "Helped-by", "Signed-off-by", when we
provide a "help:","sign:" in command line, This allows the user to
dynamically fill in the "name <email>" pair of other people in the
commit message later. It is worthwhile for users to exit with exit(0).

But those dispensable things like "Commit-Count", It must depend
on a person's statistics in the git repository. So "cnt:" is meaningless,
users' script can let it exit(1).

> I was reacting what the "count" example does, and found that
> counting commits by all authors (that is what an empty string would
> match when given to --author="") somewhat illogical in the context
> of that example.
>

The "Commit-Count" in the example here can only target a specific person,
which has great limitations.

I have a bold idea:

Our current --trailer can only fill in one data item, and we don't
expect it to fill
in multiple rows. something like "Commit-Count", we hope to count the number of
commits from everyone. But as we can see:

Commit-count: 7 Linus Arver
  1117  Linus Torvalds

So If we have the opportunity to capture every line or every "block" of content,
and feed it to git interpret-trailer, maybe we can get something like:

Commit-count: 7 Linus Arver
Commit-count: 1117  Linus Torvalds

This will definitely make it easy for us to generate a lot of trailer at once.
For example, a newbie like me, after making a patch, want to --cc all authors
of one file, maybe I only need a command to get it.

I don't know if it's a bit whimsical.

> After all, these examples are to pique readers' interest by
> demonstrating what the mechanism can do and how it can be used, and
> for this feature, I think showing that
>
>  (1) we can squelch the output from unasked-for execution;
>
>  (2) we can reject --trailer=<key>:<value> when we do not like the
>      given <value>;
>
>  (3) we can insert the trailer with the value we compute (and it is
>      OK for the computed result happens to be an empty string).
>
> should be plenty sufficient.

OK. I will add these three examples in the new patch (when .cmd merge to
master).

Thanks.
--
ZheNing Hu




[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