From: Caleb White <cdwhite3@pm.me>
To: Taylor Blau <me@ttaylorr.com>, phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v2 2/5] worktree: add `write_worktree_linking_files` function
Date: Wed, 30 Oct 2024 05:38:06 +0000 [thread overview]
Message-ID: <D58WCL821YEF.1Y68WOUZ8RJLT@pm.me> (raw)
In-Reply-To: <ZyFn9xErajxzQo29@nand.local>
On Tue Oct 29, 2024 at 5:55 PM CDT, Taylor Blau wrote:
> On Tue, Oct 29, 2024 at 02:52:36PM +0000, Phillip Wood wrote:
>> On 28/10/2024 19:09, Caleb White wrote:
>> > A new helper function, `write_worktree_linking_files()`, centralizes
>> > the logic for computing and writing either relative or absolute
>> > paths, based on the provided configuration. This function accepts
>> > `strbuf` pointers to both the worktree’s `.git` link and the
>> > repository’s `gitdir`, and then writes the appropriate path to each.
>>
>> That sounds like a useful change. I think it would be better to pass an
>> extra parameter "use_relative_paths" rather than relying on a global
>> varibale in worktree.c. Thank you for adding some documentaion for the new
>> function.
>
> Good suggestion. I definitely agree that this is a useful direction.
I didn't particularly care for the global variable either, but that was
the easiest way to get up and running. I don't want to just pass this
parameter around as that will result in changing about 6-7 function
signatures. What are some other ways settings have been propagated
into the internals? Right now, I'm thinking of just using
a getter/setter in the worktree API, which would remove the global
variable.
>> This might be better as a separate step so that reviewers can concentrate on
>> the correctness of write_werktree_linking_files() when reviewing this patch.
>
> Indeed. This patch (even though the diffstat isn't overly large) is
> somewhat noisy just because of the number of spots that needed to be
> adjusted here.
>
> I wonder if another way to split this up (in addition to what you wrote
> above) might be to introduce the new function and convert one single
> caller in the first patch. Then subsequent patches can go one callsite
> at a time and convert them to use the new function.
>
> That way, each patch is easy-ish to verify in isolation. I know that
> results in some more patches, but I think that the additional clarity I
> imagine we'll get is worth doing so.
Sounds good, I'll split this up into multiple patches for each of the
subcommands. I'll also add the tests for that subcommand in the same
patch for context.
Best,
Caleb
next prev parent reply other threads:[~2024-10-30 5:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 19:09 [PATCH v2 0/5] Allow relative worktree linking to be configured by the user Caleb White
2024-10-28 19:09 ` [PATCH v2 1/5] worktree: add CLI/config options for relative path linking Caleb White
2024-10-29 14:52 ` Phillip Wood
2024-10-30 5:27 ` Caleb White
2024-10-30 20:16 ` Taylor Blau
2024-10-30 20:21 ` Caleb White
2024-10-30 20:30 ` phillip.wood123
2024-10-30 20:36 ` Caleb White
2024-10-29 18:42 ` Taylor Blau
2024-10-30 5:07 ` Caleb White
2024-10-28 19:09 ` [PATCH v2 2/5] worktree: add `write_worktree_linking_files` function Caleb White
2024-10-29 14:52 ` Phillip Wood
2024-10-29 22:55 ` Taylor Blau
2024-10-30 5:38 ` Caleb White [this message]
2024-10-30 5:30 ` Caleb White
2024-10-28 19:09 ` [PATCH v2 3/5] worktree: add tests for worktrees with relative paths Caleb White
2024-10-29 14:52 ` Phillip Wood
2024-10-29 14:58 ` Caleb White
2024-10-29 15:43 ` phillip.wood123
2024-10-30 5:10 ` Caleb White
2024-10-29 23:00 ` Taylor Blau
2024-10-30 4:16 ` Caleb White
2024-10-28 19:10 ` [PATCH v2 4/5] setup: correctly reinitialize repository version Caleb White
2024-10-28 19:10 ` [PATCH v2 5/5] worktree: add `relativeWorktrees` extension Caleb White
2024-10-29 14:55 ` [PATCH v2 0/5] Allow relative worktree linking to be configured by the user Phillip Wood
2024-10-30 5:13 ` Caleb White
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=D58WCL821YEF.1Y68WOUZ8RJLT@pm.me \
--to=cdwhite3@pm.me \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=sunshine@sunshineco.com \
/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).