Merge branch 'jk/ok-to-fail-gc-auto-in-rebase' into maint
[gitweb.git] / path.c
diff --git a/path.c b/path.c
index c740c4ff9403bc92df4c439839bd5596ac62e48d..3cd155e27dddee6774d48522945c0615f6207d8c 100644 (file)
--- a/path.c
+++ b/path.c
@@ -363,7 +363,7 @@ void report_linked_checkout_garbage(void)
                strbuf_setlen(&sb, len);
                strbuf_addstr(&sb, path);
                if (file_exists(sb.buf))
-                       report_garbage("unused in linked checkout", sb.buf);
+                       report_garbage(PACKDIR_FILE_GARBAGE, sb.buf);
        }
        strbuf_release(&sb);
 }
@@ -740,6 +740,18 @@ int adjust_shared_perm(const char *path)
        return 0;
 }
 
+void safe_create_dir(const char *dir, int share)
+{
+       if (mkdir(dir, 0777) < 0) {
+               if (errno != EEXIST) {
+                       perror(dir);
+                       exit(1);
+               }
+       }
+       else if (share && adjust_shared_perm(dir))
+               die(_("Could not make %s writable by group"), dir);
+}
+
 static int have_same_root(const char *path1, const char *path2)
 {
        int is_abs1, is_abs2;