From 865c3b5f92d7286565a289649e8fdaa9ace8802c Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Thu, 23 Feb 2006 20:00:48 +0000 Subject: [PATCH] The new fuzzy-dir logic once again avoids calling get_dirlist() until a regular file is found in the current parent directory. --- generator.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/generator.c b/generator.c index f8ec71b5..b6abc2c0 100644 --- a/generator.c +++ b/generator.c @@ -773,6 +773,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, static int missing_below = -1, excluded_below = -1; static char *parent_dirname = ""; static struct file_list *fuzzy_dirlist = NULL; + static struct file_list *need_dirlist = (struct file_list *)""; struct file_struct *fuzzy_file = NULL; int fd = -1, f_copy = -1; STRUCT_STAT st, real_st, partial_st; @@ -788,7 +789,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (!fname) { if (fuzzy_dirlist) { - flist_free(fuzzy_dirlist); + if (fuzzy_dirlist != need_dirlist) + flist_free(fuzzy_dirlist); fuzzy_dirlist = NULL; } if (missing_below >= 0) { @@ -839,14 +841,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, full_fname(dn)); } if (fuzzy_dirlist) { - flist_free(fuzzy_dirlist); + if (fuzzy_dirlist != need_dirlist) + flist_free(fuzzy_dirlist); fuzzy_dirlist = NULL; } if (fuzzy_basis) - fuzzy_dirlist = get_dirlist(dn, -1, 1); + fuzzy_dirlist = need_dirlist; } parent_dirname = dn; + if (fuzzy_dirlist == need_dirlist && S_ISREG(file->mode)) + fuzzy_dirlist = get_dirlist(dn, -1, 1); + statret = link_stat(fname, &st, keep_dirlinks && S_ISDIR(file->mode)); stat_errno = errno; -- 2.34.1