Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Matt Hunter <m@lfurio.us>
Cc: git@vger.kernel.org, Harald Nordgren <haraldnordgren@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] init: show absolute path of (re)initialized repository
Date: Mon, 26 Oct 2026 08:01:15 +0100	[thread overview]
Message-ID: <at76u_L1yiot329r@pks.im> (raw)
In-Reply-To: <DMC7P4CPEV2X.25XRRSBEZCFPH@lfurio.us>

On Fri, Oct 23, 2026 at 08:21:11AM -0400, Matt Hunter wrote:
> On Fri Oct 23, 2026 at 2:26 AM EDT, Patrick Steinhardt wrote:
> > On Thu, Oct 22, 2026 at 08:06:32AM -0400, Matt Hunter wrote:
> >>  
> >> +test_expect_success 'init shows absolute path to gitdir' '
> >> +	expect="$(pwd)/init-path" &&
> >
> > I don't think this extra variable buys us anything, so I'd just drop it.
> >
> >> +	git init init-path >actual &&
> >> +	test_grep "$expect" actual
> >> +'
> >
> > I would have tested for the whole message, which is short enough to be
> > reasonable, I'd say.
> 
> I considered this.  I decided on this simpler version since there are
> 4 possible messages that could appear at the end of git init.  Do we
> want separate tests/assertions to check all outputs
> 
>     "Reinitialized existing shared Git repository in %s%s"
>     "Reinitialized existing Git repository in %s%s"
>     "Initialized empty shared Git repository in %s%s"
>     "Initialized empty Git repository in %s%s"
> 
> are as expected?

I feel like that'd probably be a bit excessive.

> Furthermore, the final path element is configurable as well, though
> should just be ".git" in the case of these tests.  I figured, since the
> actual breakage was about the appearance of the path, then I would just
> test _that aspect_ of the output in this test.
> 
> How do we feel about this assertion
> 
>     echo "Initialized empty Git repository in $(pwd)/init-path/.git/" >expect
>     test_cmp expect actual
> 
> which tests the whole message of just the default case?  The unnecessary
> variable you point out above is repurposed into a needed tmp file.

I'd say that's good enough for now. Thanks!

Patrick

  reply	other threads:[~2026-10-26  7:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  5:38 [PATCH] init: show absolute path of (re)initialized repository Matt Hunter
2026-10-20  6:55 ` Patrick Steinhardt
2026-10-20  9:13   ` Matt Hunter
2026-10-20 12:14     ` Patrick Steinhardt
2026-10-20 12:37   ` Harald Nordgren
2026-10-20 14:37     ` Patrick Steinhardt
2026-10-20 15:32       ` Harald Nordgren
2026-10-20 16:29       ` Junio C Hamano
2026-10-22 12:06 ` [PATCH v2] " Matt Hunter
2026-10-23  6:26   ` Patrick Steinhardt
2026-10-23 12:21     ` Matt Hunter
2026-10-26  7:01       ` Patrick Steinhardt [this message]
2026-10-28  5:16 ` [PATCH v3] " Matt Hunter
2026-10-28  7:03   ` Patrick Steinhardt
2026-10-28 15:59     ` 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=at76u_L1yiot329r@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=haraldnordgren@gmail.com \
    --cc=m@lfurio.us \
    /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