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:
-rw-r--r--worktree.c5
-rw-r--r--worktree.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/worktree.c b/worktree.c
index 0782e00983..12a766a38d 100644
--- a/worktree.c
+++ b/worktree.c
@@ -229,6 +229,11 @@ struct worktree *find_worktree(struct worktree **list,
return *list;
}
+int is_main_worktree(const struct worktree *wt)
+{
+ return !wt->id;
+}
+
int is_worktree_being_rebased(const struct worktree *wt,
const char *target)
{
diff --git a/worktree.h b/worktree.h
index 7ad15da0dc..e1c4715238 100644
--- a/worktree.h
+++ b/worktree.h
@@ -38,6 +38,11 @@ extern struct worktree *find_worktree(struct worktree **list,
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)
*/
extern void free_worktrees(struct worktree **);