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
This commit is contained in:
Junio C Hamano
2014-09-09 12:54:01 -07:00
2 changed files with 51 additions and 0 deletions

View 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;