worktree: add relative cli/config options to move command

This teaches the `worktree move` command to respect the
`--[no-]relative-paths` CLI option and `worktree.useRelativePaths`
config setting. If an existing worktree is moved with `--relative-paths`
the new path will be relative (and visa-versa).

Signed-off-by: Caleb White <cdwhite3@pm.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Caleb White
2024-11-29 22:23:03 +00:00
committed by Junio C Hamano
parent b7016344f1
commit 298d2917e2
4 changed files with 39 additions and 16 deletions

View File

@ -117,8 +117,8 @@ int validate_worktree(const struct worktree *wt,
/*
* Update worktrees/xxx/gitdir with the new path.
*/
void update_worktree_location(struct worktree *wt,
const char *path_);
void update_worktree_location(struct worktree *wt, const char *path_,
int use_relative_paths);
typedef void (* worktree_repair_fn)(int iserr, const char *path,
const char *msg, void *cb_data);