diff mbox series

[3/8] worktree: give "should be pruned?" function more meaningful name

Message ID 20200608062356.40264-4-sunshine@sunshineco.com (mailing list archive)
State New, archived
Headers show
Series worktree: tighten duplicate path detection | expand

Commit Message

Eric Sunshine June 8, 2020, 6:23 a.m. UTC
Readers of the name prune_worktree() are likely to expect the function
to actually prune a worktree, however, it only answers the question
"should this worktree be pruned?". Give it a name more reflective of its
true purpose to avoid such confusion.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 builtin/worktree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Junio C Hamano June 8, 2020, 9:25 p.m. UTC | #1
Eric Sunshine <sunshine@sunshineco.com> writes:

> Readers of the name prune_worktree() are likely to expect the function
> to actually prune a worktree, however, it only answers the question
> "should this worktree be pruned?". Give it a name more reflective of its
> true purpose to avoid such confusion.

100% agreed.
diff mbox series

Patch

diff --git a/builtin/worktree.c b/builtin/worktree.c
index f7351413af..27681a1396 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -67,7 +67,7 @@  static void delete_worktrees_dir_if_empty(void)
 	rmdir(git_path("worktrees")); /* ignore failed removal */
 }
 
-static int prune_worktree(const char *id, struct strbuf *reason)
+static int should_prune_worktree(const char *id, struct strbuf *reason)
 {
 	struct stat st;
 	char *path;
@@ -144,7 +144,7 @@  static void prune_worktrees(void)
 		if (is_dot_or_dotdot(d->d_name))
 			continue;
 		strbuf_reset(&reason);
-		if (!prune_worktree(d->d_name, &reason))
+		if (!should_prune_worktree(d->d_name, &reason))
 			continue;
 		if (show_only || verbose)
 			printf_ln(_("Removing %s/%s: %s"),