diff options
-rw-r--r-- | entry.c | 3 | ||||
-rw-r--r-- | read-cache.c | 8 |
2 files changed, 7 insertions, 4 deletions
@@ -195,6 +195,9 @@ int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath) */ unlink(path); if (S_ISDIR(st.st_mode)) { + /* If it is a gitlink, leave it alone! */ + if (S_ISDIRLNK(ntohl(ce->ce_mode))) + return 0; if (!state->force) return error("%s is a directory", path); remove_subtree(path); diff --git a/read-cache.c b/read-cache.c index e4c628f927..d2f332a622 100644 --- a/read-cache.c +++ b/read-cache.c @@ -120,9 +120,9 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st) if (ce_compare_link(ce, xsize_t(st->st_size))) return DATA_CHANGED; break; - case S_IFDIRLNK: - /* No need to do anything, we did the exact compare in "match_stat_basic" */ - break; + case S_IFDIR: + if (S_ISDIRLNK(ntohl(ce->ce_mode))) + return 0; default: return TYPE_CHANGED; } @@ -153,7 +153,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) changed |= TYPE_CHANGED; else if (ce_compare_gitlink(ce)) changed |= DATA_CHANGED; - break; + return changed; default: die("internal error: ce_mode is %o", ntohl(ce->ce_mode)); } |