Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- dir.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dir.c b/dir.c index 26c3b3a..58739f3 100644 --- a/dir.c +++ b/dir.c @@ -794,9 +794,9 @@ int is_excluded_from_list(const char *pathname, */ static struct exclude *last_exclude_matching(struct dir_struct *dir, const char *pathname, + int pathlen, int *dtype_p) { - int pathlen = strlen(pathname); int i, j; struct exclude_list_group *group; struct exclude *exclude; @@ -827,10 +827,12 @@ static struct exclude *last_exclude_matching(struct dir_struct *dir, * scans all exclude lists to determine whether pathname is excluded. * Returns 1 if true, otherwise 0. */ -static int is_excluded(struct dir_struct *dir, const char *pathname, int *dtype_p) +static int is_excluded(struct dir_struct *dir, + const char *pathname, int pathlen, + int *dtype_p) { struct exclude *exclude = - last_exclude_matching(dir, pathname, dtype_p); + last_exclude_matching(dir, pathname, pathlen, dtype_p); if (exclude) return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1; return 0; @@ -893,7 +895,8 @@ struct exclude *last_exclude_matching_path(struct path_exclude_check *check, if (ch == '/') { int dt = DT_DIR; exclude = last_exclude_matching(check->dir, - path->buf, &dt); + path->buf, path->len, + &dt); if (exclude) { check->exclude = exclude; return exclude; @@ -905,7 +908,7 @@ struct exclude *last_exclude_matching_path(struct path_exclude_check *check, /* An entry in the index; cannot be a directory with subentries */ strbuf_setlen(path, 0); - return last_exclude_matching(check->dir, name, dtype); + return last_exclude_matching(check->dir, name, namelen, dtype); } /* @@ -1297,7 +1300,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir, int exclude; START_CLOCK(); - exclude = is_excluded(dir, path->buf, &dtype); + exclude = is_excluded(dir, path->buf, path->len, &dtype); STOP_CLOCK(tv_is_excluded); if (exclude && (dir->flags & DIR_COLLECT_IGNORED) -- 1.8.1.2.536.gf441e6d -- 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