diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-02-12 16:49:37 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-12 13:13:35 -0800 |
commit | c64a8d200f4109df86c6d4716ea4da58df450e34 (patch) | |
tree | eaf8198f7aa5a888178e7a807dcc482c988b30fe /t | |
parent | worktree move: new command (diff) | |
download | tgif-c64a8d200f4109df86c6d4716ea4da58df450e34.tar.xz |
worktree move: accept destination as directory
Similar to "mv a b/", which is actually "mv a b/a", we extract basename
of source worktree and create a directory of the same name at
destination if dst path is a directory.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t2028-worktree-move.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh index 0f8abc0854..deb486cd8e 100755 --- a/t/t2028-worktree-move.sh +++ b/t/t2028-worktree-move.sh @@ -85,4 +85,15 @@ test_expect_success 'move main worktree' ' test_must_fail git worktree move . def ' +test_expect_success 'move worktree to another dir' ' + toplevel="$(pwd)" && + mkdir some-dir && + git worktree move destination some-dir && + test_path_is_missing source && + git worktree list --porcelain | grep "^worktree.*/some-dir/destination" && + git -C some-dir/destination log --format=%s >actual2 && + echo init >expected2 && + test_cmp expected2 actual2 +' + test_done |