summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commit.c3
-rw-r--r--src/odb.c6
-rw-r--r--src/odb.h3
3 files changed, 9 insertions, 3 deletions
diff --git a/src/commit.c b/src/commit.c
index 05b70a983..4a340058a 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -159,6 +159,9 @@ static int git_commit__create_internal(
if (git_repository_odb__weakptr(&odb, repo) < 0)
goto cleanup;
+ if (git_odb__freshen(odb, tree) < 0)
+ goto cleanup;
+
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJ_COMMIT) < 0)
goto cleanup;
diff --git a/src/odb.c b/src/odb.c
index dc98a6ff7..3f2ac02f3 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -695,7 +695,7 @@ static int odb_freshen_1(
return (int)found;
}
-static int odb_freshen(git_odb *db, const git_oid *id)
+int git_odb__freshen(git_odb *db, const git_oid *id)
{
assert(db && id);
@@ -1167,7 +1167,7 @@ int git_odb_write(
assert(oid && db);
git_odb_hash(oid, data, len, type);
- if (odb_freshen(db, oid))
+ if (git_odb__freshen(db, oid))
return 0;
for (i = 0; i < db->backends.length && error < 0; ++i) {
@@ -1293,7 +1293,7 @@ int git_odb_stream_finalize_write(git_oid *out, git_odb_stream *stream)
git_hash_final(out, stream->hash_ctx);
- if (odb_freshen(stream->backend->odb, out))
+ if (git_odb__freshen(stream->backend->odb, out))
return 0;
return stream->finalize_write(stream, out);
diff --git a/src/odb.h b/src/odb.h
index 31a9fd1b9..76e82f1dd 100644
--- a/src/odb.h
+++ b/src/odb.h
@@ -98,6 +98,9 @@ int git_odb__read_header_or_object(
git_odb_object **out, size_t *len_p, git_otype *type_p,
git_odb *db, const git_oid *id);
+/* freshen an entry in the object database */
+int git_odb__freshen(git_odb *db, const git_oid *id);
+
/* fully free the object; internal method, DO NOT EXPORT */
void git_odb_object__free(void *object);