summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-09 19:54:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-09 19:54:01 (GMT)
commita75e759e595bf79d69841e6822784164da54ac23 (patch)
treef97647066886af7abca346f480ad41456a841c7b /read-cache.c
parent4645b014c5c82a3b753374e7ea2bb1e7d7d3e562 (diff)
parentccad42d4836e2bb4d1843eccd94f58f0189abb1d (diff)
downloadgit-a75e759e595bf79d69841e6822784164da54ac23.zip
git-a75e759e595bf79d69841e6822784164da54ac23.tar.gz
git-a75e759e595bf79d69841e6822784164da54ac23.tar.bz2
Merge branch 'rs/refresh-beyond-symlink'
"git add x" where x that used to be a directory has become a symbolic link to a directory misbehaved. * rs/refresh-beyond-symlink: read-cache: check for leading symlinks when refreshing index
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 5d3c8bd..6f0057f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -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;