summaryrefslogtreecommitdiff
path: root/src/pack-objects.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 17:34:36 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-23 09:48:20 -0500
commit69ca594bafd438fea419b1ebe757a9d13da4d254 (patch)
treeb7b760bb90311ee4cd511d697d54c1ff8a1d97a8 /src/pack-objects.c
parent55eb096b93d4e658bfc0d19270b56f00dff9ec0d (diff)
downloadlibgit2-ethomson/oid_cleanups.tar.gz
packbuilder: use the packfile name instead of hashethomson/oid_cleanups
Deprecate the `git_packfile_hash` function. Callers should use the new `git_packfile_name` function which provides a unique packfile name.
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index e5fc625a4..35c1d55db 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1422,7 +1422,12 @@ int git_packbuilder_write(
if ((error = git_indexer_commit(indexer, &stats)) < 0)
goto cleanup;
+#ifndef GIT_DEPRECATE_HARD
git_oid_cpy(&pb->pack_oid, git_indexer_hash(indexer));
+#endif
+
+ pb->pack_name = git__strdup(git_indexer_name(indexer));
+ GIT_ERROR_CHECK_ALLOC(pb->pack_name);
cleanup:
git_indexer_free(indexer);
@@ -1432,10 +1437,17 @@ cleanup:
#undef PREPARE_PACK
+#ifndef GIT_DEPRECATE_HARD
const git_oid *git_packbuilder_hash(git_packbuilder *pb)
{
return &pb->pack_oid;
}
+#endif
+
+const char *git_packbuilder_name(git_packbuilder *pb)
+{
+ return pb->pack_name;
+}
static int cb_tree_walk(
@@ -1803,5 +1815,7 @@ void git_packbuilder_free(git_packbuilder *pb)
git_hash_ctx_cleanup(&pb->ctx);
git_zstream_free(&pb->zstream);
+ git__free(pb->pack_name);
+
git__free(pb);
}