X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=entry.c;h=222aaa374b8268828e9d529a8afacb8830acc281;hb=8d13caf795902812d44809e2f222fb2334030603;hp=44f4b897d4ff7afff7dbab92ce8754645ad8da6a;hpb=093d50e0d226b879e24753ce18f4eb4b754807c6;p=git.git diff --git a/entry.c b/entry.c index 44f4b897d..222aaa374 100644 --- a/entry.c +++ b/entry.c @@ -218,7 +218,6 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t * to emulate by hand - much easier to let the system * just do the right thing) */ - unlink(path); if (S_ISDIR(st.st_mode)) { /* If it is a gitlink, leave it alone! */ if (S_ISGITLINK(ce->ce_mode)) @@ -226,7 +225,8 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t if (!state->force) return error("%s is a directory", path); remove_subtree(path); - } + } else if (unlink(path)) + return error("unable to unlink old '%s' (%s)", path, strerror(errno)); } else if (state->not_new) return 0; create_directories(path, state);