Re: [PATCH v10 2/3] interpret-trailers: add own-identity option

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

 



Junio C Hamano <gitster@xxxxxxxxx> 于2021年3月20日周六 下午1:50写道:
>
> Jeff King <peff@xxxxxxxx> writes:
>
> > If I understand Junio's suggestion correctly, it is very similar to how
> > "commit --author" works. See how it calls find_author_by_nickname(),
> > which finds the first commit matching the name, and then pulls out the
> > full name from format_commit_message().
>
> Yup.
>
> But I have to warn readers that it would not be a sane approach to
> simply expose find_author_by_nickname() from builtin/commit.c as if
> it is a generally reusable helper function.  In a very limited
> context of "git commit", what the helper does is OK to run a single
> revision traversal without cleaning the parsed commit objects and
> object flag bits after finding a single commit.
>
> But generally, it would not be an approach that would scale (e.g. I
> do not know if we can expect to be able to call the helper function
> twice and get sensible results out of it).

Hi, Jeff and Junio,

`find_author_by_nickname` is indeed a good way to find
 the `author <email>` in the "last" commit that matches
the specified name, but after testing, `find_author_by_nickname` is
as Junio say, it is not reusable(use it twice, git will call die), but why?




[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