Make "checkout-cache" silently skip up-to-date files.
[gitweb.git] / checkout-cache.c
index cfbc47ee2db059092fc432865269b82943dfa084..6ed8b69eca879aed6d25105d29533dc789918e73 100644 (file)
@@ -46,7 +46,7 @@ static void create_directories(const char *path)
                len = slash - path;
                memcpy(buf, path, len);
                buf[len] = 0;
-               mkdir(buf, 0700);
+               mkdir(buf, 0755);
        }
 }
 
@@ -96,12 +96,14 @@ static int write_entry(struct cache_entry *ce)
 
 static int checkout_entry(struct cache_entry *ce)
 {
-       if (!force) {
-               struct stat st;
+       struct stat st;
 
-               if (!stat(ce->name, &st)) {
-                       unsigned changed = cache_match_stat(ce, &st);
-                       if (changed && !quiet)
+       if (!stat(ce->name, &st)) {
+               unsigned changed = cache_match_stat(ce, &st);
+               if (!changed)
+                       return 0;
+               if (!force) {
+                       if (!quiet)
                                fprintf(stderr, "checkout-cache: %s already exists\n", ce->name);
                        return 0;
                }