]> git.ipfire.org Git - thirdparty/git.git/commit
worktree: refactor `repair_worktree_after_gitdir_move()`
authorCaleb White <cdwhite3@pm.me>
Fri, 29 Nov 2024 22:23:16 +0000 (22:23 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Dec 2024 00:36:18 +0000 (09:36 +0900)
commit2037ca85ad93ec905b46543df6df4080f6ca258b
tree17df2cdf8d6c5027dc5762571adc8a0301586baf
parente6df1ee2c13405ef7077256fef49424f69d61125
worktree: refactor `repair_worktree_after_gitdir_move()`

This refactors `repair_worktree_after_gitdir_move()` to use the new
`write_worktree_linking_files` function. It also preserves the
relativity of the linking files; e.g., if an existing worktree used
absolute paths then the repaired paths will be absolute (and visa-versa).
`repair_worktree_after_gitdir_move()` is used to repair both sets of
worktree linking files if the `.git` directory is moved during a
re-initialization using `git init`.

This also adds a test case for reinitializing a repository that has
relative worktrees.

Signed-off-by: Caleb White <cdwhite3@pm.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0001-init.sh
worktree.c