git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: gitmlko@not-evil.de
Cc: git@vger.kernel.org, Michael Lohmann <git@lohmann.sh>
Subject: Re: [PATCH] builtin/reflog: respect user config in "write" subcommand
Date: Tue, 30 Sep 2025 13:26:41 +0200	[thread overview]
Message-ID: <aNu-cTrJwPdcW6hq@pks.im> (raw)
In-Reply-To: <20250930091411.14179-1-gitmlko@not-evil.de>

On Tue, Sep 30, 2025 at 11:14:11AM +0200, gitmlko@not-evil.de wrote:
> From: Michael Lohmann <git@lohmann.sh>

Is there any specific reason why the originating mail address and the
author information disagree with one another? It makes it hard for us to
verify that these mail addresses actually map to the same person.

> Previously, the reflog write command only recognized the environment
> variables GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL. It did not account
> for user.name and user.email settings from the Git configuration.

Nit: we typically write our commit messages in the following style:

  - We describe the problem in the present tense.

  - We then proceed to describe why that problem exists. In our context,
    it's also relevant to explain why our tests didn't catch the issue.

  - Finally, we use imperative mood to say how the problem is fixed, as
    if instructing the code to change.

Happy to provide more guidance here as needed.

> Since the test suite always sets these variables, it was unnoticed that
> not present, it would use the system config as defaults instead of the
> git config.
> 
> Co-Authored-By: Patrick Steinhardt <ps@pks.im>

Another tiny nit: This should be "Co-authored-by", with everything
except the leading "C" being lower-case.

> diff --git a/t/t1421-reflog-write.sh b/t/t1421-reflog-write.sh
> index 46df64c176..65fc4cae93 100755
> --- a/t/t1421-reflog-write.sh
> +++ b/t/t1421-reflog-write.sh
> @@ -101,10 +101,19 @@ test_expect_success 'simple writes' '
>  		EOF
>  
>  		git reflog write refs/heads/something $COMMIT_OID $COMMIT_OID second &&
> -		test_reflog_matches . refs/heads/something <<-EOF
> +		test_reflog_matches . refs/heads/something <<-EOF &&
>  		$ZERO_OID $COMMIT_OID $SIGNATURE	first
>  		$COMMIT_OID $COMMIT_OID $SIGNATURE	second
>  		EOF
> +
> +		sane_unset GIT_COMMITTER_NAME &&
> +		sane_unset GIT_COMMITTER_EMAIL &&
> +		git config --local user.name "Author" &&
> +		git config --local user.email "a@uth.or" &&
> +		git reflog write refs/heads/something_new $ZERO_OID $COMMIT_OID first &&
> +		test_reflog_matches . refs/heads/something_new <<-EOF
> +		$ZERO_OID $COMMIT_OID Author <a@uth.or> 1112911993 -0700	first
> +		EOF
>  	)
>  '

I think it would be preferable to make this a separate test case.

Thanks for working on this!

Patrick

  reply	other threads:[~2025-09-30 11:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 11:11 git reflog write does not pick up user.name and user.email from config Michael
2025-09-29 23:57 ` Patrick Steinhardt
2025-09-30  9:14   ` [PATCH] builtin/reflog: respect user config in "write" subcommand gitmlko
2025-09-30 11:26     ` Patrick Steinhardt [this message]
2025-09-30 14:37       ` [PATCH v2] " git
2025-09-30 17:13         ` Junio C Hamano
2025-09-30 19:53           ` [PATCH v3] " Michael Lohmann
2025-10-01  7:37             ` Patrick Steinhardt
2025-10-01 16:50               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aNu-cTrJwPdcW6hq@pks.im \
    --to=ps@pks.im \
    --cc=git@lohmann.sh \
    --cc=git@vger.kernel.org \
    --cc=gitmlko@not-evil.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).