summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNickolai Belakovski <nbelakovski@gmail.com>2018-10-30 06:24:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-31 02:41:47 (GMT)
commitd236f12bdeb478bbaabf056bc611c34cf9218ca8 (patch)
tree0f108fa94f81fa5169cd99d76697a2949e666e2e
parente21cc076a31c8f6a39946f914338aa4dd6c9de3d (diff)
downloadgit-d236f12bdeb478bbaabf056bc611c34cf9218ca8.zip
git-d236f12bdeb478bbaabf056bc611c34cf9218ca8.tar.gz
git-d236f12bdeb478bbaabf056bc611c34cf9218ca8.tar.bz2
worktree: rename is_worktree_locked to worktree_lock_reason
A function prefixed with 'is_' would be expected to return a boolean, however this function returns a string. Signed-off-by: Nickolai Belakovski <nbelakovski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/worktree.c10
-rw-r--r--worktree.c2
-rw-r--r--worktree.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index c4abbde..5e84026 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -245,7 +245,7 @@ static void validate_worktree_add(const char *path, const struct add_opts *opts)
if (!wt)
goto done;
- locked = !!is_worktree_locked(wt);
+ locked = !!worktree_lock_reason(wt);
if ((!locked && opts->force) || (locked && opts->force > 1)) {
if (delete_git_dir(wt->id))
die(_("unable to re-add worktree '%s'"), path);
@@ -682,7 +682,7 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
if (is_main_worktree(wt))
die(_("The main working tree cannot be locked or unlocked"));
- old_reason = is_worktree_locked(wt);
+ old_reason = worktree_lock_reason(wt);
if (old_reason) {
if (*old_reason)
die(_("'%s' is already locked, reason: %s"),
@@ -714,7 +714,7 @@ static int unlock_worktree(int ac, const char **av, const char *prefix)
die(_("'%s' is not a working tree"), av[0]);
if (is_main_worktree(wt))
die(_("The main working tree cannot be locked or unlocked"));
- if (!is_worktree_locked(wt))
+ if (!worktree_lock_reason(wt))
die(_("'%s' is not locked"), av[0]);
ret = unlink_or_warn(git_common_path("worktrees/%s/locked", wt->id));
free_worktrees(worktrees);
@@ -787,7 +787,7 @@ static int move_worktree(int ac, const char **av, const char *prefix)
validate_no_submodules(wt);
if (force < 2)
- reason = is_worktree_locked(wt);
+ reason = worktree_lock_reason(wt);
if (reason) {
if (*reason)
die(_("cannot move a locked working tree, lock reason: %s\nuse 'move -f -f' to override or unlock first"),
@@ -900,7 +900,7 @@ static int remove_worktree(int ac, const char **av, const char *prefix)
if (is_main_worktree(wt))
die(_("'%s' is a main working tree"), av[0]);
if (force < 2)
- reason = is_worktree_locked(wt);
+ reason = worktree_lock_reason(wt);
if (reason) {
if (*reason)
die(_("cannot remove a locked working tree, lock reason: %s\nuse 'remove -f -f' to override or unlock first"),
diff --git a/worktree.c b/worktree.c
index b0d0b54..befdbe7 100644
--- a/worktree.c
+++ b/worktree.c
@@ -235,7 +235,7 @@ int is_main_worktree(const struct worktree *wt)
return !wt->id;
}
-const char *is_worktree_locked(struct worktree *wt)
+const char *worktree_lock_reason(struct worktree *wt)
{
assert(!is_main_worktree(wt));
diff --git a/worktree.h b/worktree.h
index 6b12a3c..55d449b 100644
--- a/worktree.h
+++ b/worktree.h
@@ -10,7 +10,7 @@ struct worktree {
char *path;
char *id;
char *head_ref; /* NULL if HEAD is broken or detached */
- char *lock_reason; /* private - use is_worktree_locked */
+ char *lock_reason; /* private - use worktree_lock_reason */
struct object_id head_oid;
int is_detached;
int is_bare;
@@ -60,7 +60,7 @@ 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);
+extern const char *worktree_lock_reason(struct worktree *wt);
#define WT_VALIDATE_WORKTREE_MISSING_OK (1 << 0)