mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
worktree.c: add is_worktree_locked()
We need this later to avoid double locking a worktree, or unlocking one when it's not even locked. 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
984ad9e56c
commit
346ef53058
@@ -5,10 +5,12 @@ struct worktree {
|
||||
char *path;
|
||||
char *id;
|
||||
char *head_ref;
|
||||
char *lock_reason; /* internal use */
|
||||
unsigned char head_sha1[20];
|
||||
int is_detached;
|
||||
int is_bare;
|
||||
int is_current;
|
||||
int lock_reason_valid;
|
||||
};
|
||||
|
||||
/* Functions for acting on the information about worktrees. */
|
||||
@@ -42,6 +44,12 @@ extern struct worktree *find_worktree(struct worktree **list,
|
||||
*/
|
||||
extern int is_main_worktree(const struct worktree *wt);
|
||||
|
||||
/*
|
||||
* Return the reason string if the given worktree is locked or NULL
|
||||
* otherwise.
|
||||
*/
|
||||
extern const char *is_worktree_locked(struct worktree *wt);
|
||||
|
||||
/*
|
||||
* Free up the memory for worktree(s)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user