summaryrefslogtreecommitdiff
path: root/odb.h
diff options
context:
space:
mode:
Diffstat (limited to 'odb.h')
-rw-r--r--odb.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/odb.h b/odb.h
index 82093753c8..9e3dd9d6df 100644
--- a/odb.h
+++ b/odb.h
@@ -64,6 +64,14 @@ struct odb_source {
struct multi_pack_index *midx;
/*
+ * Figure out whether this is the local source of the owning
+ * repository, which would typically be its ".git/objects" directory.
+ * This local object directory is usually where objects would be
+ * written to.
+ */
+ bool local;
+
+ /*
* This is a temporary object store created by the tmp_objdir
* facility. Disable ref updates since the objects in the store
* might be discarded on rollback.
@@ -199,11 +207,14 @@ struct odb_transaction *odb_transaction_begin(struct object_database *odb);
void odb_transaction_commit(struct odb_transaction *transaction);
/*
- * Find source by its object directory path. Dies in case the source couldn't
- * be found.
+ * Find source by its object directory path. Returns a `NULL` pointer in case
+ * the source could not be found.
*/
struct odb_source *odb_find_source(struct object_database *odb, const char *obj_dir);
+/* Same as `odb_find_source()`, but dies in case the source doesn't exist. */
+struct odb_source *odb_find_source_or_die(struct object_database *odb, const char *obj_dir);
+
/*
* Replace the current writable object directory with the specified temporary
* object directory; returns the former primary source.
@@ -278,8 +289,8 @@ void odb_add_to_alternates_file(struct object_database *odb,
* recursive alternates it points to), but do not modify the on-disk alternates
* file.
*/
-void odb_add_to_alternates_memory(struct object_database *odb,
- const char *dir);
+struct odb_source *odb_add_to_alternates_memory(struct object_database *odb,
+ const char *dir);
/*
* Read an object from the database. Returns the object data and assigns object