From: Junio C Hamano Date: Sat, 9 May 2009 04:12:41 +0000 (-0700) Subject: Merge branch 'maint-1.6.0' into maint-1.6.1 X-Git-Tag: v1.6.3.1~1^2~1^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f29d669a91b2c8f1c68c1f4fb10f03456a997fa8?hp=-c Merge branch 'maint-1.6.0' into maint-1.6.1 * maint-1.6.0: dir.c: Fix two minor grammatical errors in comments --- f29d669a91b2c8f1c68c1f4fb10f03456a997fa8 diff --combined dir.c index 2c18e417d1,4e6b988d37..53ad921a0b --- a/dir.c +++ b/dir.c @@@ -52,8 -52,13 +52,8 @@@ int common_prefix(const char **pathspec return prefix; } -static inline int special_char(unsigned char c1) -{ - return !c1 || c1 == '*' || c1 == '[' || c1 == '?' || c1 == '\\'; -} - /* - * 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 @@@ -75,7 -80,7 +75,7 @@@ static int match_one(const char *match for (;;) { unsigned char c1 = *match; unsigned char c2 = *name; - if (special_char(c1)) + if (isspecial(c1)) break; if (c1 != c2) return 0; @@@ -287,7 -292,7 +287,7 @@@ static void prep_exclude(struct dir_str 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, @@@ -382,7 -387,7 +382,7 @@@ static struct dir_entry *dir_entry_new( return ent; } -struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len) +static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len) { if (cache_name_exists(pathname, len, ignore_case)) return NULL; @@@ -391,7 -396,7 +391,7 @@@ return dir->entries[dir->nr++] = dir_entry_new(pathname, len); } -struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len) +static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len) { if (cache_name_pos(pathname, len) >= 0) return NULL; @@@ -675,12 -680,17 +675,12 @@@ static int cmp_name(const void *p1, con */ static int simple_length(const char *match) { - const char special[256] = { - [0] = 1, ['?'] = 1, - ['\\'] = 1, ['*'] = 1, - ['['] = 1 - }; int len = -1; for (;;) { unsigned char c = *match++; len++; - if (special[c]) + if (isspecial(c)) return len; } } @@@ -717,12 -727,8 +717,12 @@@ static void free_simplify(struct path_s int read_directory(struct dir_struct *dir, const char *path, const char *base, int baselen, const char **pathspec) { - struct path_simplify *simplify = create_simplify(pathspec); + struct path_simplify *simplify; + + if (has_symlink_leading_path(strlen(path), path)) + return dir->nr; + simplify = create_simplify(pathspec); read_directory_recursive(dir, path, base, baselen, 0, simplify); free_simplify(simplify); qsort(dir->entries, dir->nr, sizeof(struct dir_entry *), cmp_name);