On Thu, Jul 11, 2013 at 6:30 PM, Thomas Gummerer <t.gummerer@xxxxxxxxx> wrote: > Duy Nguyen <pclouds@xxxxxxxxx> writes: > >> On Wed, Jul 10, 2013 at 3:10 AM, Thomas Gummerer <t.gummerer@xxxxxxxxx> wrote: >>>> If you happen to know that certain entries match the given pathspec, >>>> you could help the caller avoid match_pathspec'ing again by set a bit >>>> in ce_flags. >>> >>> I currently don't know which entries do match the pathspec from just >>> reading the index file, additional calls would be needed. I don't think >>> that would be worth the overhead. >> >> Yeah I now see that you select what to load in v5 with the adjusted >> pathspec, not the input pathspec. Originally I thought you match the >> input pathspec against every file entry in the index :P Your adjusted >> pathspec looks like what common_prefix is for. It's cheaper than >> creating adjusted_pathspec from match_pathspec and reduces loading in >> major cases, where glob is not used. >> >> Still, creating an adjusted pathspec this way looks iffy. You need to >> understand pathspec in order to strip the filename part out to match >> the directory match only. An alternative is use >> tree_entry_interesting. It goes along well with tree traversal and can >> be used to match directories with original pathspec. Once you see it >> matches an entry in a directory, you could skip matching the rest of >> the files and load the whole directory. read_index_filtered_v5 and >> read_entries may need some tweaking though. I'll try it and post a >> patch later if I succeed. > > Hrm, I played around a bit with this idea, but I couldn't figure out how > to make it work. For it to work we would still have to load some > entries in a directory at least? Or is there a way to match the > directories, which I just haven't figured out yet? Yes you have to load some entries first. Even if a directory does not match, we only know until at least the first file in the directory. OK there might be problems because tree_entry_interesting expects all entries in a directory to be memcmp sorted, without trailing slash for subdirectories. I need to check again if v5 sort order is compatible.. -- Duy -- 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