summaryrefslogtreecommitdiff
path: root/worktree.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-24 09:53:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-24 19:04:26 (GMT)
commit4ddddc1f1d763d3c4e0e57af1153c6d48ca4db9b (patch)
treef11fca1c2cedc65196fb297d172c1832e69ea35b /worktree.h
parent8279ed033f703d4115bee620dccd32a9ec94d9aa (diff)
downloadgit-4ddddc1f1d763d3c4e0e57af1153c6d48ca4db9b.zip
git-4ddddc1f1d763d3c4e0e57af1153c6d48ca4db9b.tar.gz
git-4ddddc1f1d763d3c4e0e57af1153c6d48ca4db9b.tar.bz2
worktree.c: add validate_worktree()
This function is later used by "worktree move" and "worktree remove" to ensure that we have a good connection between the repository and the worktree. For example, if a worktree is moved manually, the worktree location recorded in $GIT_DIR/worktrees/.../gitdir is incorrect and we should not move that one. 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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/worktree.h b/worktree.h
index c28a880..cb577de 100644
--- a/worktree.h
+++ b/worktree.h
@@ -3,6 +3,8 @@
#include "refs.h"
+struct strbuf;
+
struct worktree {
char *path;
char *id;
@@ -60,6 +62,13 @@ extern int is_main_worktree(const struct worktree *wt);
extern const char *is_worktree_locked(struct worktree *wt);
/*
+ * 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);
+
+/*
* Free up the memory for worktree(s)
*/
extern void free_worktrees(struct worktree **);