diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2018-08-28 23:20:26 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-30 18:28:02 +0200 |
commit | 3a5404333c6c8b5897e78c9dcb711d623035791b (patch) | |
tree | 30604b281cb194ab54045d65faa2dc0df71bd2a3 /t/t2028-worktree-move.sh | |
parent | worktree: teach 'remove' to override lock when --force given twice (diff) | |
download | git-3a5404333c6c8b5897e78c9dcb711d623035791b.tar.xz git-3a5404333c6c8b5897e78c9dcb711d623035791b.zip |
worktree: delete .git/worktrees if empty after 'remove'
For cleanliness, "git worktree prune" deletes the .git/worktrees
directory if it is empty after pruning is complete.
For consistency, make "git worktree remove <path>" likewise delete
.git/worktrees if it is empty after the removal.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2028-worktree-move.sh')
-rwxr-xr-x | t/t2028-worktree-move.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh index 1b5079e8fa..33c0337733 100755 --- a/t/t2028-worktree-move.sh +++ b/t/t2028-worktree-move.sh @@ -173,4 +173,16 @@ test_expect_success 'remove locked worktree (force)' ' git worktree remove --force --force gumby ' +test_expect_success 'remove cleans up .git/worktrees when empty' ' + git init moog && + ( + cd moog && + test_commit bim && + git worktree add --detach goom && + test_path_exists .git/worktrees && + git worktree remove goom && + test_path_is_missing .git/worktrees + ) +' + test_done |