From 8f09a98e1809dcdfd9d25b8268657bac4d942e6a Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 14 Jul 2016 16:23:24 -0400 Subject: 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. --- include/git2/sys/odb_backend.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/git2') 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 @@ -83,6 +83,17 @@ struct git_odb_backend { git_odb_writepack **, git_odb_backend *, git_odb *odb, 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. -- cgit v1.2.1