Merge branch 'maint'
[gitweb.git] / entry.c
diff --git a/entry.c b/entry.c
index 5daacc2fe51eada819bedea05f958fbf87f5b889..cc841edf9051460b3a382ea25c0097f245ec8884 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -35,7 +35,7 @@ static void create_directories(const char *path, int path_len,
                 */
                if (mkdir(buf, 0777)) {
                        if (errno == EEXIST && state->force &&
-                           !unlink(buf) && !mkdir(buf, 0777))
+                           !unlink_or_warn(buf) && !mkdir(buf, 0777))
                                continue;
                        die("cannot create directory at %s", buf);
                }
@@ -147,7 +147,8 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 
                wrote = write_in_full(fd, new, size);
                /* use fstat() only when path == ce->name */
-               if (state->refresh_cache && !to_tempfile && !state->base_dir_len) {
+               if (fstat_is_reliable() &&
+                   state->refresh_cache && !to_tempfile && !state->base_dir_len) {
                        fstat(fd, &st);
                        fstat_done = 1;
                }