]> git.ipfire.org Git - thirdparty/git.git/commit
worktree: add relative cli/config options to `repair` command
authorCaleb White <cdwhite3@pm.me>
Fri, 29 Nov 2024 22:23:10 +0000 (22:23 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Dec 2024 00:36:17 +0000 (09:36 +0900)
commite6df1ee2c13405ef7077256fef49424f69d61125
tree3e514475befc6fac0a354870d244e04cf25f0a6d
parent298d2917e26520791b47ba5d38c1866e21894cc7
worktree: add relative cli/config options to `repair` command

This teaches the `worktree repair` command to respect the
`--[no-]relative-paths` CLI option and `worktree.useRelativePaths`
config setting. If an existing worktree with an absolute path is repaired
with `--relative-paths`, the links will be replaced with relative paths,
even if the original path was correct. This allows a user to covert
existing worktrees between absolute/relative as desired.

To simplify things, both linking files are written when one of the files
needs to be repaired. In some cases, this fixes the other file before it
is checked, in other cases this results in a correct file being written
with the same contents.

Signed-off-by: Caleb White <cdwhite3@pm.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-worktree.txt
builtin/worktree.c
t/t2406-worktree-repair.sh
worktree.c
worktree.h