Thread (37 messages) 37 messages, 5 authors, 2018-03-05

Re: [PATCH 7/7] worktree remove: allow it when $GIT_WORK_TREE is already gone

From: Eric Sunshine <hidden>
Date: 2018-02-02 12:59:36

On Wed, Jan 24, 2018 at 4:53 AM, Nguyễn Thái Ngọc Duy [off-list ref] wrote:
quoted hunk ↗ jump to hunk
[...]
- $GIT_WORK_TREE _can_ be missing if the worktree is locked. In that
  case we must not delete $GIT_DIR because the real $GIT_WORK_TREE may
  be in a usb stick somewhere. This is already handled because we
  check for lock first.
[...]

Noticed-by: Kaartic Sivaraam [off-list ref]
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
@@ -116,4 +116,12 @@ test_expect_success 'force remove worktree with untracked file' '
+test_expect_success 'remove missing worktree' '
+       git worktree add to-be-gone &&
+       test -d .git/worktrees/to-be-gone &&
+       mv to-be-gone gone &&
+       git worktree remove to-be-gone &&
+       test_path_is_missing .git/worktrees/to-be-gone
+'
Perhaps there could also be a test to verify that a missing but locked
worktree is _not_ removed?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help