Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-02-12 17:49:35 +0300
committerJohannes Schindelin <johannes.schindelin@gmx.de>2021-02-12 17:49:35 +0300
commitb1726b1a38ee913cec7c72f4f4a5fe0c4b386386 (patch)
tree507edce7937738c2a1b92a9da9d728f39fb85b83 /symlinks.c
parent9206d27eb5e76bbb3a4e59e3c53f92eaa0caa97b (diff)
parent8b1a5f33d3ed427b0a6eaee595537805db6bc38c (diff)
Sync with 2.20.5
* maint-2.20: Git 2.20.5 Git 2.19.6 Git 2.18.5 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.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/symlinks.c b/symlinks.c
index 69d458a24d..7dbb6b23d9 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;
+}