Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- 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.7.0.377.g4cd97dd -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html