Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-02-12 12:49:40 +0300
committerJunio C Hamano <gitster@pobox.com>2018-02-13 00:13:35 +0300
commitee6763af0a3b97225803c6c908a29de40336cf38 (patch)
tree5345b7b1b711cec6a79f2f6a81e442423de2ee54 /worktree.h
parentcc73385cf6c5c229458775bc92e7dbbe24d11611 (diff)
worktree remove: allow it when $GIT_WORK_TREE is already gone
"git worktree remove" basically consists of two things - delete $GIT_WORK_TREE - delete $GIT_DIR (which is $SUPER_GIT_DIR/worktrees/something) If $GIT_WORK_TREE is already gone for some reason, we should be able to finish the job by deleting $GIT_DIR. Two notes: - $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. - validate_worktree() is still called because it may do more checks in future (and it already does something else, like checking main worktree, but that's irrelevant in this case) Noticed-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> 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 'worktree.h')
-rw-r--r--worktree.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/worktree.h b/worktree.h
index a913428c3d..fe38ce10c3 100644
--- a/worktree.h
+++ b/worktree.h
@@ -61,12 +61,15 @@ extern int is_main_worktree(const struct worktree *wt);
*/
extern const char *is_worktree_locked(struct worktree *wt);
+#define WT_VALIDATE_WORKTREE_MISSING_OK (1 << 0)
+
/*
* Return zero if the worktree is in good condition. Error message is
* returned if "errmsg" is not NULL.
*/
extern int validate_worktree(const struct worktree *wt,
- struct strbuf *errmsg);
+ struct strbuf *errmsg,
+ unsigned flags);
/*
* Update worktrees/xxx/gitdir with the new path.