summaryrefslogtreecommitdiff
path: root/builtin-rev-parse.c
diff options
context:
space:
mode:
authorKjetil Barvik <barvik@broadpark.no>2009-01-18 15:14:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-18 21:54:54 (GMT)
commitbad4a54fa6fe8a9bbdfb5c3e413268eefde69b75 (patch)
tree6bb9c1f60d63ac3eff00b14cec6f7d5c32c04c62 /builtin-rev-parse.c
parent09c9306658f793f2cad1ed7856b55a7c4e758703 (diff)
downloadgit-bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75.zip
git-bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75.tar.gz
git-bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75.tar.bz2
lstat_cache(): introduce has_dirs_only_path() function
The create_directories() function in entry.c currently calls stat() or lstat() for each path component of the pathname 'path' each and every time. For the 'git checkout' command, this function is called on each file for which we must do an update (ce->ce_flags & CE_UPDATE), so we get lots and lots of calls. To fix this, we make a new wrapper to the lstat_cache() function, and call the wrapper function instead of the calls to the stat() or the lstat() functions. Since the paths given to the create_directories() function, is sorted alphabetically, the new wrapper would be very cache effective in this situation. To support it we must update the lstat_cache() function to be able to say that "please test the complete length of 'name'", and also to give it the length of a prefix, where the cache should use the stat() function instead of the lstat() function to test each path component. Thanks to Junio C Hamano, Linus Torvalds and Rene Scharfe for valuable comments to this patch! Signed-off-by: Kjetil Barvik <barvik@broadpark.no> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rev-parse.c')
0 files changed, 0 insertions, 0 deletions