]> git.ipfire.org Git - thirdparty/git.git/commit
worktree: add `write_worktree_linking_files()` function
authorCaleb White <cdwhite3@pm.me>
Fri, 29 Nov 2024 22:22:47 +0000 (22:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Dec 2024 00:36:17 +0000 (09:36 +0900)
commit4dac9e3c01cf056edd315e0ed26e6df1c4d94571
tree090dffaff7ae9cd4aca2f4ec64d48b855f704690
parent5976310916458868b5cbd9d8c7cc7de5af418230
worktree: add `write_worktree_linking_files()` function

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.
The `relativeWorktrees` extension is automatically set when a worktree
is linked with relative paths.

Signed-off-by: Caleb White <cdwhite3@pm.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
worktree.c
worktree.h