diff options
author | Edward Thomson <ethomson@github.com> | 2016-07-14 16:23:24 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-08-04 15:12:04 -0400 |
commit | 8f09a98e1809dcdfd9d25b8268657bac4d942e6a (patch) | |
tree | 25f4b977d9a9055569d95a5ba5b038dfbfb01d6a /include/git2/sys | |
parent | d2794b0e37e98206b991ba4c8639ddf53c03bdb9 (diff) | |
download | libgit2-8f09a98e1809dcdfd9d25b8268657bac4d942e6a.tar.gz |
odb: freshen existing objects when writing
When writing an object, we calculate its OID and see if it exists in the
object database. If it does, we need to freshen the file that contains
it.
Diffstat (limited to 'include/git2/sys')
-rw-r--r-- | include/git2/sys/odb_backend.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index e423a9236..9bcc50ddd 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -84,6 +84,17 @@ struct git_odb_backend { git_transfer_progress_cb progress_cb, void *progress_payload); /** + * "Freshens" an already existing object, updating its last-used + * time. This occurs when `git_odb_write` was called, but the + * object already existed (and will not be re-written). The + * underlying implementation may want to update last-used timestamps. + * + * If callers implement this, they should return `0` if the object + * exists and was freshened, and non-zero otherwise. + */ + int (* freshen)(git_odb_backend *, const git_oid *); + + /** * Frees any resources held by the odb (including the `git_odb_backend` * itself). An odb backend implementation must provide this function. */ |