diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-12 15:47:42 +0100 |
---|---|---|
committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-12 15:47:42 +0100 |
commit | 9b77cec89b64f0910df911952ccee0cdf0046f48 (patch) | |
tree | 7862bb9a330acb1c2ab3f6273d8b659249d3a253 /symlinks.c | |
parent | Git 2.18.4 (diff) | |
parent | Git 2.17.6 (diff) | |
download | tgif-9b77cec89b64f0910df911952ccee0cdf0046f48.tar.xz |
Sync with 2.17.6
* maint-2.17:
Git 2.17.6
unpack_trees(): start with a fresh lstat cache
run-command: invalidate lstat cache after a command finished
checkout: fix bug that makes checkout follow symlinks in leading path
Diffstat (limited to 'symlinks.c')
-rw-r--r-- | symlinks.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/symlinks.c b/symlinks.c index 5261e8cf49..53b770be08 100644 --- a/symlinks.c +++ b/symlinks.c @@ -267,6 +267,13 @@ int has_dirs_only_path(const char *name, int len, int prefix_len) */ static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len) { + /* + * Note: this function is used by the checkout machinery, which also + * takes care to properly reset the cache when it performs an operation + * that would leave the cache outdated. If this function starts caching + * anything else besides FL_DIR, remember to also invalidate the cache + * when creating or deleting paths that might be in the cache. + */ return lstat_cache(cache, name, len, FL_DIR|FL_FULLPATH, prefix_len) & FL_DIR; @@ -321,3 +328,20 @@ void remove_scheduled_dirs(void) { do_remove_scheduled_dirs(0); } + +void invalidate_lstat_cache(void) +{ + reset_lstat_cache(&default_cache); +} + +#undef rmdir +int lstat_cache_aware_rmdir(const char *path) +{ + /* Any change in this function must be made also in `mingw_rmdir()` */ + int ret = rmdir(path); + + if (!ret) + invalidate_lstat_cache(); + + return ret; +} |