mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
8279ed033f
commit
4ddddc1f1d
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "refs.h"
|
||||
|
||||
struct strbuf;
|
||||
|
||||
struct worktree {
|
||||
char *path;
|
||||
char *id;
|
||||
@@ -59,6 +61,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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user