X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=dir.c;h=bbfcb566e63310d38848b0b76076fb051a7446c8;hb=95a877a34c3838a92a99794ebc3b082f6f525899;hp=c91ebfb46f929f926e1925c2db830c5847f3223b;hpb=b79376cdf3bd6ee922261776613d085a7b36ffd9;p=git.git diff --git a/dir.c b/dir.c index c91ebfb46..bbfcb566e 100644 --- a/dir.c +++ b/dir.c @@ -53,7 +53,7 @@ int common_prefix(const char **pathspec) } /* - * Does 'match' matches the given name? + * Does 'match' match the given name? * A match is found if * * (1) the 'match' string is leading directory of 'name', or @@ -156,7 +156,7 @@ void add_exclude(const char *string, const char *base, if (len && string[len - 1] == '/') { char *s; x = xmalloc(sizeof(*x) + len); - s = (char*)(x+1); + s = (char *)(x+1); memcpy(s, string, len - 1); s[len - 1] = '\0'; string = s; @@ -290,7 +290,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen) dir->basebuf[baselen] = '\0'; } -/* Scan the list and let the last match determines the fate. +/* Scan the list and let the last match determine the fate. * Return 1 for exclude, 0 for include and -1 for undecided. */ static int excluded_1(const char *pathname, @@ -396,7 +396,7 @@ static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathna static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len) { - if (cache_name_pos(pathname, len) >= 0) + if (!cache_name_is_other(pathname, len)) return NULL; ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->ignored_alloc); @@ -576,7 +576,7 @@ static int get_dtype(struct dirent *de, const char *path) */ static int read_directory_recursive(struct dir_struct *dir, const char *path, const char *base, int baselen, int check_only, const struct path_simplify *simplify) { - DIR *fdir = opendir(path); + DIR *fdir = opendir(*path ? path : "."); int contents = 0; if (fdir) {