pr-2205/yoichi/worktree-repair-relative-path-handling-v2
tagged this
20 Aug 15:46
From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com> Given a state where the cross references between the worktree and the repository (specifically worktree/id/gitdir in the main repository and the .git file in the worktree) are recorded using absolute paths, setting 'worktree.useRelativePaths=true' and running 'git worktree repair' within the main worktree converts them to relative paths. On the other hand, given a state where the cross references are recorded using relative paths, one would expect (by symmetry) that setting 'worktree.useRelativePath=false' and running 'git worktree repair' would convert them to absolute paths. However, they remain as relative paths. This is because we wrongly use read_gitfile_gently() which always returns an absolute path. To fix this, introduce read_gitfile_raw() that is almost same as read_gitfile_gently(), but it skips existence check of the referenced repository and returns the unmodified path read from .git file. Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2205.v2.git.1787240760069.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2205.git.1786799480344.gitgitgadget@gmail.com