Code

lstat_cache: guard against full match of length of 'name' parameter
[git.git] / symlinks.c
index 4bdded39c5c5fc491189661bfeca045472970f5b..7b0a86d35776e8695423c13403c9f4fa3465017d 100644 (file)
@@ -91,6 +91,10 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
                        longest_path_match(name, len, cache->path, cache->len,
                                           &previous_slash);
                match_flags = cache->flags & track_flags & (FL_NOENT|FL_SYMLINK);
+
+               if (!(track_flags & FL_FULLPATH) && match_len == len)
+                       match_len = last_slash = previous_slash;
+
                if (match_flags && match_len == cache->len)
                        return match_flags;
                /*