Refactor type_from_string() to allow continuing after detecting an error
[gitweb.git] / read-cache.c
index 5d3c8bd4aaffda9915a3fd62d9d9800f4ac8baff..6f0057fe66a59e1239703ee4458de200304f727a 100644 (file)
@@ -1064,6 +1064,14 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
                return ce;
        }
 
+       if (has_symlink_leading_path(ce->name, ce_namelen(ce))) {
+               if (ignore_missing)
+                       return ce;
+               if (err)
+                       *err = ENOENT;
+               return NULL;
+       }
+
        if (lstat(ce->name, &st) < 0) {
                if (ignore_missing && errno == ENOENT)
                        return ce;