diff options
| author | Caleb White <cdwhite3@pm.me> | 2024-11-29 22:23:03 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-02 09:36:17 +0900 |
| commit | 298d2917e26520791b47ba5d38c1866e21894cc7 (patch) | |
| tree | e5378a20327f39de9775c218e7508b142266628f /builtin/worktree.c | |
| parent | b7016344f1d4ef8457821e0436f335ec388b8dac (diff) | |
| download | git-298d2917e26520791b47ba5d38c1866e21894cc7.tar.gz | |
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>
Diffstat (limited to 'builtin/worktree.c')
| -rw-r--r-- | builtin/worktree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c index e3b4a71ee0..3021515069 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -1190,6 +1190,8 @@ static int move_worktree(int ac, const char **av, const char *prefix) OPT__FORCE(&force, N_("force move even if worktree is dirty or locked"), PARSE_OPT_NOCOMPLETE), + OPT_BOOL(0, "relative-paths", &use_relative_paths, + N_("use relative paths for worktrees")), OPT_END() }; struct worktree **worktrees, *wt; @@ -1242,7 +1244,7 @@ static int move_worktree(int ac, const char **av, const char *prefix) if (rename(wt->path, dst.buf) == -1) die_errno(_("failed to move '%s' to '%s'"), wt->path, dst.buf); - update_worktree_location(wt, dst.buf); + update_worktree_location(wt, dst.buf, use_relative_paths); strbuf_release(&dst); free_worktrees(worktrees); |
