summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorLibravatar Kjetil Barvik <barvik@broadpark.no>2009-01-18 16:14:52 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-01-18 13:54:54 -0800
commitbad4a54fa6fe8a9bbdfb5c3e413268eefde69b75 (patch)
tree6bb9c1f60d63ac3eff00b14cec6f7d5c32c04c62 /fsck.c
parentlstat_cache(): introduce has_symlink_or_noent_leading_path() function (diff)
downloadtgif-bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75.tar.xz
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 'fsck.c')
0 files changed, 0 insertions, 0 deletions