From 984ad9e56c9d884f7f1aa7d6b2052f3fb082ee5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 3 Jun 2016 19:19:40 +0700 Subject: worktree.c: add is_main_worktree() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main worktree _is_ different. You can lock (*) a linked worktree but not the main one, for example. Provide an API for checking that. (*) Add the file $GIT_DIR/worktrees/xxx/locked to avoid worktree xxx from being removed or moved. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- worktree.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'worktree.h') diff --git a/worktree.h b/worktree.h index 7ad15da0dc..e1c4715238 100644 --- a/worktree.h +++ b/worktree.h @@ -37,6 +37,11 @@ extern struct worktree *find_worktree(struct worktree **list, const char *prefix, const char *arg); +/* + * Return true if the given worktree is the main one. + */ +extern int is_main_worktree(const struct worktree *wt); + /* * Free up the memory for worktree(s) */ -- cgit v1.2.3