mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
298d2917e2
commit
e6df1ee2c1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user