summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 08d2248)
raw | patch | inline | side by side (parent: 08d2248)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 25 Dec 2006 11:11:34 +0000 (03:11 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 25 Dec 2006 11:29:08 +0000 (03:29 -0800) |
This teaches the internal read_directory() routine to return
both interesting and ignored pathnames.
Signed-off-by: Junio C Hamano <junkio@cox.net>
both interesting and ignored pathnames.
Signed-off-by: Junio C Hamano <junkio@cox.net>
dir.c | patch | blob | history | |
dir.h | patch | blob | history |
index 8477472c03d2e1d5a4a76091792f6fe99327516c..dd188a8c56c02e1bbe2c8fc0cfb9ce67cdeb948d 100644 (file)
--- a/dir.c
+++ b/dir.c
return 0;
}
-static void add_name(struct dir_struct *dir, const char *pathname, int len)
+static void add_name(struct dir_struct *dir, const char *pathname, int len,
+ int ignored_entry)
{
struct dir_entry *ent;
dir->entries = xrealloc(dir->entries, alloc*sizeof(ent));
}
ent = xmalloc(sizeof(*ent) + len + 1);
+ ent->ignored_entry = ignored_entry;
ent->len = len;
memcpy(ent->name, pathname, len);
ent->name[len] = 0;
@@ -314,6 +316,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
while ((de = readdir(fdir)) != NULL) {
int len;
+ int ignored_entry;
if ((de->d_name[0] == '.') &&
(de->d_name[1] == 0 ||
@@ -322,11 +325,12 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
continue;
len = strlen(de->d_name);
memcpy(fullname + baselen, de->d_name, len+1);
- if (excluded(dir, fullname) != dir->show_ignored) {
- if (!dir->show_ignored || DTYPE(de) != DT_DIR) {
- continue;
- }
- }
+ ignored_entry = excluded(dir, fullname);
+
+ if (!dir->show_both &&
+ (ignored_entry != dir->show_ignored) &&
+ (!dir->show_ignored || DTYPE(de) != DT_DIR))
+ continue;
switch (DTYPE(de)) {
struct stat st;
@@ -364,7 +368,8 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
if (check_only)
goto exit_early;
else
- add_name(dir, fullname, baselen + len);
+ add_name(dir, fullname, baselen + len,
+ ignored_entry);
}
exit_early:
closedir(fdir);
index c9197279495b1e5b6b6265932019ccc093427696..08c634547229fc1353fd092fb226293ed07368c3 100644 (file)
--- a/dir.h
+++ b/dir.h
struct dir_entry {
- int len;
+ unsigned ignored_entry : 1;
+ unsigned int len : 15;
char name[FLEX_ARRAY]; /* more */
};
struct dir_struct {
int nr, alloc;
- unsigned int show_ignored:1,
+ unsigned int show_both: 1,
+ show_ignored:1,
show_other_directories:1,
hide_empty_directories:1;
struct dir_entry **entries;