aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
Diffstat (limited to 'odb')
-rw-r--r--odb/source-files.c8
-rw-r--r--odb/source.h17
2 files changed, 25 insertions, 0 deletions
diff --git a/odb/source-files.c b/odb/source-files.c
index 65d7805c5a..d0f7ee072e 100644
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ -28,6 +28,13 @@ static void odb_source_files_free(struct odb_source *source)
free(files);
}
+static void odb_source_files_reprepare(struct odb_source *source)
+{
+ struct odb_source_files *files = odb_source_files_downcast(source);
+ odb_source_loose_reprepare(&files->base);
+ packfile_store_reprepare(files->packed);
+}
+
struct odb_source_files *odb_source_files_new(struct object_database *odb,
const char *path,
bool local)
@@ -40,6 +47,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
files->packed = packfile_store_new(&files->base);
files->base.free = odb_source_files_free;
+ files->base.reprepare = odb_source_files_reprepare;
/*
* Ideally, we would only ever store absolute paths in the source. This
diff --git a/odb/source.h b/odb/source.h
index 4973fb4251..09cca839fe 100644
--- a/odb/source.h
+++ b/odb/source.h
@@ -57,6 +57,13 @@ struct odb_source {
* all associated resources. The function will never be called with a NULL pointer.
*/
void (*free)(struct odb_source *source);
+
+ /*
+ * This callback is expected to clear underlying caches of the object
+ * database source. The function is called when the repository has for
+ * example just been repacked so that new objects will become visible.
+ */
+ void (*reprepare)(struct odb_source *source);
};
/*
@@ -96,4 +103,14 @@ void odb_source_free(struct odb_source *source);
*/
void odb_source_release(struct odb_source *source);
+/*
+ * Reprepare the object database source and clear any caches. Depending on the
+ * backend used this may have the effect that concurrently-written objects
+ * become visible.
+ */
+static inline void odb_source_reprepare(struct odb_source *source)
+{
+ source->reprepare(source);
+}
+
#endif