diff options
| author | Vicent Martà <vicent@github.com> | 2013-01-10 08:15:10 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-01-10 08:15:10 -0800 |
| commit | 7bacc2c8c5831ac185dc35bd74d26b92337c8a07 (patch) | |
| tree | 7f44553f7fe3312706c3bfb5f7e123b7b927bd26 /include/git2 | |
| parent | 3f31ce8d9526cadc88270dad7effeb304a38d5ea (diff) | |
| parent | 8fe6bc5c47640537a20c351adc5ccaa6a212312b (diff) | |
| download | libgit2-7bacc2c8c5831ac185dc35bd74d26b92337c8a07.tar.gz | |
Merge pull request #1182 from libgit2/odb-file-refresh
Sane refresh logic for #1180
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/odb.h | 20 | ||||
| -rw-r--r-- | include/git2/odb_backend.h | 2 |
2 files changed, 22 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 diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index 029c61b9f..dbc3981f6 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -89,6 +89,8 @@ struct git_odb_backend { struct git_odb_backend *, const git_oid *); + int (* refresh)(struct git_odb_backend *); + int (* foreach)( struct git_odb_backend *, git_odb_foreach_cb cb, |
