Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- dir.c | 121 ----------------------------------------------------------------- dir.h | 3 -- 2 files changed, 0 insertions(+), 124 deletions(-) diff --git a/dir.c b/dir.c index 2946b2d..4094962 100644 --- a/dir.c +++ b/dir.c @@ -11,11 +11,6 @@ #include "tree-walk.h" #include "string-list.h" -struct path_simplify { - int len; - const char *path; -}; - static int read_directory_recursive(struct dir_struct *dir, struct strbuf *base, int check_only, @@ -604,15 +599,6 @@ static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathna 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) -{ - if (!cache_name_is_other(pathname, len)) - return NULL; - - ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->ignored_alloc); - return dir->ignored[dir->ignored_nr++] = dir_entry_new(pathname, len); -} - /* Read and convert directory to tree object (with invalid SHA-1) */ static void* dir_to_tree(struct strbuf *path, unsigned long *size) { @@ -845,31 +831,6 @@ static enum directory_treatment treat_directory(struct dir_struct *dir, } /* - * This is an inexact early pruning of any recursive directory - * reading - if the path cannot possibly be in the pathspec, - * return true, and we'll skip it early. - */ -static int simplify_away(const char *path, int pathlen, const struct path_simplify *simplify) -{ - if (simplify) { - for (;;) { - const char *match = simplify->path; - int len = simplify->len; - - if (!match) - break; - if (len > pathlen) - len = pathlen; - if (!memcmp(path, match, len)) - return 0; - simplify++; - } - return 1; - } - return 0; -} - -/* * This function flags pathspecs that are completely excluded, which * usually means an input mistake. In other words, if all matched * _files_ of a pathspec are excluded, flag the pathspec. @@ -1087,88 +1048,6 @@ static int cmp_name(const void *p1, const void *p2) e2->name, e2->len); } -/* - * Return the length of the "simple" part of a path match limiter. - */ -static int simple_length(const char *match) -{ - int len = -1; - - for (;;) { - unsigned char c = *match++; - len++; - if (c == '\0' || is_glob_special(c)) - return len; - } -} - -static struct path_simplify *create_simplify(const char **pathspec) -{ - int nr, alloc = 0; - struct path_simplify *simplify = NULL; - - if (!pathspec) - return NULL; - - for (nr = 0 ; ; nr++) { - const char *match; - if (nr >= alloc) { - alloc = alloc_nr(alloc); - simplify = xrealloc(simplify, alloc * sizeof(*simplify)); - } - match = *pathspec++; - if (!match) - break; - simplify[nr].path = match; - simplify[nr].len = simple_length(match); - } - simplify[nr].path = NULL; - simplify[nr].len = 0; - return simplify; -} - -static void free_simplify(struct path_simplify *simplify) -{ - free(simplify); -} - -#if 0 -static int treat_leading_path(struct dir_struct *dir, - const char *path, int len, - const struct path_simplify *simplify) -{ - char pathbuf[PATH_MAX]; - int baselen, blen; - const char *cp; - - while (len && path[len - 1] == '/') - len--; - if (!len) - return 1; - baselen = 0; - while (1) { - cp = path + baselen + !!baselen; - cp = memchr(cp, '/', path + len - cp); - if (!cp) - baselen = len; - else - baselen = cp - path; - memcpy(pathbuf, path, baselen); - pathbuf[baselen] = '\0'; - if (!is_directory(pathbuf)) - return 0; - if (simplify_away(pathbuf, baselen, simplify)) - return 0; - blen = baselen; - if (treat_one_path(dir, pathbuf, &blen, simplify, - DT_DIR, NULL) == path_ignored) - return 0; /* do not recurse into it */ - if (len <= baselen) - return 1; /* finished checking */ - } -} -#endif - int read_directory(struct dir_struct *dir, const char *path, int len, const char **pathspec) { diff --git a/dir.h b/dir.h index 362d7b1..7a7d818 100644 --- a/dir.h +++ b/dir.h @@ -33,7 +33,6 @@ struct exclude_stack { struct dir_struct { int nr, alloc; - int ignored_nr, ignored_alloc; enum { DIR_SHOW_IGNORED = 1<<0, DIR_SHOW_OTHER_DIRECTORIES = 1<<1, @@ -42,7 +41,6 @@ struct dir_struct { DIR_COLLECT_IGNORED = 1<<4 } flags; struct dir_entry **entries; - struct dir_entry **ignored; int *useful; /* Include info (a joint of ps1 and ps2) */ @@ -82,7 +80,6 @@ extern int read_directory(struct dir_struct *, const char *path, int len, const extern int excluded_from_list(const char *pathname, int pathlen, const char *basename, int *dtype, struct exclude_list *el); extern int excluded(struct dir_struct *, const char *, int *); -struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len); extern int add_excludes_from_file_to_list(const char *fname, const char *base, int baselen, char **buf_p, struct exclude_list *which, int check_index); extern void add_excludes_from_file(struct dir_struct *, const char *fname); -- 1.7.3.1.256.g2539c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html