diff options
| author | Yoichi NAKAYAMA <yoichi.nakayama@gmail.com> | 2026-08-28 15:19:46 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-28 10:22:04 -0700 |
| commit | 53d330c360227e66298e0f4dba2ce6b6a3a36c37 (patch) | |
| tree | baa781df676a3ff55904d8062ee329f1c7386af6 /contrib/persistent-https | |
| parent | 1a3e64c6c4a623626ff0687008732a8e007e2a1c (diff) | |
worktree repair: detect relative path in .git file correctly
Given a state in which 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.
Conversely, given a state in which the cross-references are recorded
using relative paths, one would expect that setting
'worktree.useRelativePaths=false' and running 'git worktree repair'
would convert them to absolute paths. However, they remain as relative
paths.
This is because we incorrectly use read_gitfile_gently(), which always
returns an absolute path. To fix this, introduce read_gitfile_raw(),
which reads the path from the .git file without resolving it to an
absolute path.
Because read_gitfile_raw() does not validate the path with
is_git_directory(), repair_gitfile() performs this validation to
preserve the existing behavior.
Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
