Re: [PATCH v10 2/3] interpret-trailers: add own-identity option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 20, 2021, 05:50 UTC
- Message-ID
- <xmqq4kh6l6fd.fsf@gitster.g>
- In-Reply-To
- <YFWCvePMGvBY/I9v@coredump.intra.peff.net>
Jeff King <peff@peff.net> 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).