summaryrefslogtreecommitdiff
path: root/include/git2/odb.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-01-03 20:36:26 +0100
committerVicent Marti <tanoku@gmail.com>2013-01-10 15:34:56 +0100
commit4a863c06662053a8530a0dcb24e0a2daa33e05cf (patch)
tree7cf411ca542687c7bda92d17809be88efd28a2e7 /include/git2/odb.h
parenta22ad9fd1f1f938fb9b8ac77939dda8a3b81a00e (diff)
downloadlibgit2-4a863c06662053a8530a0dcb24e0a2daa33e05cf.tar.gz
Sane refresh logic
All the ODB backends have a specific refresh interface. When reading an object, first we attempt every single backend: if the read fails, then we refresh all the backends and retry the read one more time to see if the object has appeared.
Diffstat (limited to 'include/git2/odb.h')
-rw-r--r--include/git2/odb.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h
index f39e7b541..8fd1a95be 100644
--- a/include/git2/odb.h
+++ b/include/git2/odb.h
@@ -192,6 +192,26 @@ GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_od
GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
/**
+ * Refresh the object database to load newly added files.
+ *
+ * If the object databases have changed on disk while the library
+ * is running, this function will force a reload of the underlying
+ * indexes.
+ *
+ * Use this function when you're confident that an external
+ * application has tampered with the ODB.
+ *
+ * NOTE that it is not necessary to call this function at all. The
+ * library will automatically attempt to refresh the ODB
+ * when a lookup fails, to see if the looked up object exists
+ * on disk but hasn't been loaded yet.
+ *
+ * @param db database to refresh
+ * @return 0 on success, error code otherwise
+ */
+GIT_EXTERN(int) git_odb_refresh(struct git_odb *db);
+
+/**
* List all objects available in the database
*
* The callback will be called for each object available in the