From: Patrick Steinhardt Date: Mon, 26 Oct 2026 07:01:15 GMT Subject: Re: [PATCH v2] init: show absolute path of (re)initialized repository Message-ID: In-Reply-To: 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