summaryrefslogtreecommitdiff
path: root/src/odb_loose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r--src/odb_loose.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 228d4c334..1653e2783 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -918,6 +918,23 @@ cleanup:
return error;
}
+static int loose_backend__freshen(
+ git_odb_backend *_backend,
+ const git_oid *oid)
+{
+ loose_backend *backend = (loose_backend *)_backend;
+ git_buf path = GIT_BUF_INIT;
+ int error;
+
+ if (object_file_name(&path, backend, oid) < 0)
+ return -1;
+
+ error = git_futils_touch(path.ptr);
+ git_buf_free(&path);
+
+ return error;
+}
+
static void loose_backend__free(git_odb_backend *_backend)
{
loose_backend *backend;
@@ -975,6 +992,7 @@ int git_odb_backend_loose(
backend->parent.exists = &loose_backend__exists;
backend->parent.exists_prefix = &loose_backend__exists_prefix;
backend->parent.foreach = &loose_backend__foreach;
+ backend->parent.freshen = &loose_backend__freshen;
backend->parent.free = &loose_backend__free;
*backend_out = (git_odb_backend *)backend;