From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 728591F9FC for ; Sat, 20 Mar 2021 05:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbhCTFGH (ORCPT ); Sat, 20 Mar 2021 01:06:07 -0400 Received: from cloud.peff.net ([104.130.231.41]:43194 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbhCTFGH (ORCPT ); Sat, 20 Mar 2021 01:06:07 -0400 Received: (qmail 11649 invoked by uid 109); 20 Mar 2021 05:06:06 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 20 Mar 2021 05:06:06 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 9395 invoked by uid 111); 20 Mar 2021 05:06:07 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 20 Mar 2021 01:06:07 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 20 Mar 2021 01:06:05 -0400 From: Jeff King To: ZheNing Hu Cc: Junio C Hamano , ZheNing Hu via GitGitGadget , Git List , "Bradley M. Kuhn" , Brandon Casey , Shourya Shukla , Christian Couder , Rafael Silva Subject: Re: [PATCH v10 2/3] interpret-trailers: add own-identity option Message-ID: References: <42590e95deeece6ba65e0432c3a59746e717fee3.1616066156.git.gitgitgadget@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Sat, Mar 20, 2021 at 10:54:38AM +0800, ZheNing Hu wrote: > I am looking for how to extract each author or committer from the log. > I just know I can use: > > $ git log --pretty="%an %ae" | sort | uniq > > get all unique author from a git repo. > Is there any function in the source code of git to get them? 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(). -Peff