]> git.ipfire.org Git - thirdparty/git.git/blobdiff - tmp-objdir.h
Merge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'
[thirdparty/git.git] / tmp-objdir.h
index b1e45b4c75d2d8877dce507a7f2134aa93da8e17..cda5ec7677881c5a47bb5f2ebf3edc3a3140a73c 100644 (file)
@@ -10,7 +10,7 @@
  *
  * Example:
  *
- *     struct tmp_objdir *t = tmp_objdir_create();
+ *     struct tmp_objdir *t = tmp_objdir_create("incoming");
  *     if (!run_command_v_opt_cd_env(cmd, 0, NULL, tmp_objdir_env(t)) &&
  *         !tmp_objdir_migrate(t))
  *             printf("success!\n");
 struct tmp_objdir;
 
 /*
- * Create a new temporary object directory; returns NULL on failure.
+ * Create a new temporary object directory with the specified prefix;
+ * returns NULL on failure.
  */
-struct tmp_objdir *tmp_objdir_create(void);
+struct tmp_objdir *tmp_objdir_create(const char *prefix);
 
 /*
  * Return a list of environment strings, suitable for use with
@@ -51,4 +52,26 @@ int tmp_objdir_destroy(struct tmp_objdir *);
  */
 void tmp_objdir_add_as_alternate(const struct tmp_objdir *);
 
+/*
+ * Replaces the writable object store in the current process with the temporary
+ * object directory and makes the former main object store an alternate.
+ * If will_destroy is nonzero, the object directory may not be migrated.
+ */
+void tmp_objdir_replace_primary_odb(struct tmp_objdir *, int will_destroy);
+
+/*
+ * If the primary object database was replaced by a temporary object directory,
+ * restore it to its original value while keeping the directory contents around.
+ * Returns NULL if the primary object database was not replaced.
+ */
+struct tmp_objdir *tmp_objdir_unapply_primary_odb(void);
+
+/*
+ * Reapplies the former primary temporary object database, after potentially
+ * changing its relative path.
+ */
+void tmp_objdir_reapply_primary_odb(struct tmp_objdir *, const char *old_cwd,
+               const char *new_cwd);
+
+
 #endif /* TMP_OBJDIR_H */