Skip to content

Commit

Permalink
verify_path(): simplify check at the directory boundary
Browse files Browse the repository at this point in the history
We simply want to say "At a directory boundary, be careful with a name
that begins with a dot, forbid a name that ends with the boundary
character or has duplicated bounadry characters".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jun 7, 2011
1 parent 56948cb commit 3bdf09c
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,16 +784,9 @@ int verify_path(const char *path)
if (is_dir_sep(c)) {
inside:
c = *path++;
switch (c) {
default:
continue;
case '/': case '\0':
break;
case '.':
if (verify_dotfile(path))
continue;
}
return 0;
if ((c == '.' && !verify_dotfile(path)) ||
is_dir_sep(c) || c == '\0')
return 0;
}
c = *path++;
}
Expand Down

0 comments on commit 3bdf09c

Please sign in to comment.