diff options
author | Edward Thomson <ethomson@github.com> | 2017-03-03 13:26:29 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2017-03-03 14:12:00 +0000 |
commit | 52d03f37f70ebde3e0a7794a60dbf68d0e69b9e8 (patch) | |
tree | ba8f647aca21274e92de8d3fecfa85199aa8cde3 /src | |
parent | 3348570a0c544747f3a916010ee6064a91f98996 (diff) | |
download | libgit2-ethomson/freshen_trees.tar.gz |
git_commit_create: freshen tree objects in commitethomson/freshen_trees
Freshen the tree object that a commit points to during commit time.
Diffstat (limited to 'src')
-rw-r--r-- | src/commit.c | 3 | ||||
-rw-r--r-- | src/odb.c | 6 | ||||
-rw-r--r-- | src/odb.h | 3 |
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; @@ -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); @@ -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); |