Thread (3 messages) 3 messages, 2 authors, 2016-06-15

Re: [PATCH] ls-files: fix overeager pathspec optimization

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:59
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
Linus Torvalds [off-list ref] writes:
quoted
I'd have to see both patches to be able to tell. I do admit that while I
acked your patch, it sure ain't _pretty_ to do that special odd
"has_leading_ignored_dir()" thing.
Revised patch (v4) series is coming shortly.
Having sent these patches, I am wondering if the simplest fix might be this
one-liner.
diff --git a/dir.c b/dir.c
index d0999ba..7fba335 100644
--- a/dir.c
+++ b/dir.c
@@ -788,3 +788,3 @@ int read_directory(struct dir_struct *dir, const char *path, int len, const char
 	simplify = create_simplify(pathspec);
-	read_directory_recursive(dir, path, len, 0, simplify);
+	read_directory_recursive(dir, "", 0, 0, simplify);
 	free_simplify(simplify);
What my series does is to keep all the "depending on dir->flags and what
excluded() says for path, decide to recurse, add it to dir->ignored[],
etc." logic and optimize only the readdir() loop, pretending as if it
returned only the entry on the "common prefix" path and nothing else, as
we know all other paths will be skipped by either simplified away or
filtered by in_pathspec() check.

If the directories we are reading are not humongous, maybe using this much
simpler patch might be preferrable (although it is completely untested).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help