diff options
author | Caleb White <cdwhite3@pm.me> | 2024-11-29 23:23:10 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-12-02 01:36:17 +0100 |
commit | e6df1ee2c13405ef7077256fef49424f69d61125 (patch) | |
tree | 3e514475befc6fac0a354870d244e04cf25f0a6d /worktree.h | |
parent | worktree: add relative cli/config options to `move` command (diff) | |
download | git-e6df1ee2c13405ef7077256fef49424f69d61125.tar.xz git-e6df1ee2c13405ef7077256fef49424f69d61125.zip |
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>
Diffstat (limited to 'worktree.h')
-rw-r--r-- | worktree.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/worktree.h b/worktree.h index 9c699d080d..38145df80f 100644 --- a/worktree.h +++ b/worktree.h @@ -129,7 +129,7 @@ typedef void (* worktree_repair_fn)(int iserr, const char *path, * function, if non-NULL, is called with the path of the worktree and a * description of the repair or error, along with the callback user-data. */ -void repair_worktrees(worktree_repair_fn, void *cb_data); +void repair_worktrees(worktree_repair_fn, void *cb_data, int use_relative_paths); /* * Repair the linked worktrees after the gitdir has been moved. @@ -151,7 +151,8 @@ void repair_worktree_after_gitdir_move(struct worktree *wt, const char *old_path * worktree and a description of the repair or error, along with the callback * user-data. */ -void repair_worktree_at_path(const char *, worktree_repair_fn, void *cb_data); +void repair_worktree_at_path(const char *, worktree_repair_fn, + void *cb_data, int use_relative_paths); /* * Free up the memory for a worktree. |