From: Nguyễn Thái Ngọc Duy Date: Wed, 13 Apr 2016 13:15:36 GMT Subject: [PATCH 15/25] worktree.c: add is_main_worktree() Message-ID: <1460553346-12985-16-git-send-email-pclouds@gmail.com> In-Reply-To: <1460553346-12985-1-git-send-email-pclouds@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 5 +++++ worktree.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/worktree.c b/worktree.c index e444ad1..e878f49 100644 --- a/worktree.c +++ b/worktree.c @@ -214,6 +214,11 @@ struct worktree *find_worktree_by_path(struct worktree **list, return wt; } +int is_main_worktree(const struct worktree *wt) +{ + return wt && !wt->id; +} + char *find_shared_symref(const char *symref, const char *target) { char *existing = NULL; diff --git a/worktree.h b/worktree.h index c163b6b..c7a4d20 100644 --- a/worktree.h +++ b/worktree.h @@ -34,6 +34,11 @@ extern struct worktree *find_worktree_by_path(struct worktree **list, const char *path_); /* + * 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 */ extern void clear_worktree(struct worktree *); -- 2.8.0.rc0.210.gd302cd2