add is_dot_or_dotdot inline function
A new inline function is_dot_or_dotdot is used to check if the directory name is either "." or "..". It returns a non-zero value if the given string is "." or "..". It's applicable to a lot of Git source code. Signed-off-by: Alexander Potashev <aspotashev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
c123b7c5fb
commit
8ca12c0d62
5
entry.c
5
entry.c
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "blob.h"
|
||||
#include "dir.h"
|
||||
|
||||
static void create_directories(const char *path, const struct checkout *state)
|
||||
{
|
||||
@ -62,9 +63,7 @@ static void remove_subtree(const char *path)
|
||||
*name++ = '/';
|
||||
while ((de = readdir(dir)) != NULL) {
|
||||
struct stat st;
|
||||
if ((de->d_name[0] == '.') &&
|
||||
((de->d_name[1] == 0) ||
|
||||
((de->d_name[1] == '.') && de->d_name[2] == 0)))
|
||||
if (is_dot_or_dotdot(de->d_name))
|
||||
continue;
|
||||
strcpy(name, de->d_name);
|
||||
if (lstat(pathbuf, &st))
|
||||
|
Reference in New Issue
Block a user