Skip to content

Commit 72c378d

Browse files
mhaggergitster
authored andcommitted
cache_tree_find(): remove redundant checks
slash is initialized to a value that cannot be NULL. So remove the guards against slash == NULL later in the loop. Suggested-by: David Kastrup <dak@gnu.org> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2f93541 commit 72c378d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cache-tree.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,9 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
564564
if (!sub)
565565
return NULL;
566566
it = sub->cache_tree;
567-
if (slash)
568-
while (*slash && *slash == '/')
569-
slash++;
570-
if (!slash || !*slash)
567+
while (*slash && *slash == '/')
568+
slash++;
569+
if (!*slash)
571570
return it; /* prefix ended with slashes */
572571
path = slash;
573572
}

0 commit comments

Comments
 (0)