summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pack-objects.c14
-rw-r--r--src/pack-objects.h3
2 files changed, 17 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);
}
diff --git a/src/pack-objects.h b/src/pack-objects.h
index cefee40ef..53c9f5d45 100644
--- a/src/pack-objects.h
+++ b/src/pack-objects.h
@@ -73,7 +73,10 @@ struct git_packbuilder {
git_oidmap *walk_objects;
git_pool object_pool;
+#ifndef GIT_DEPRECATE_HARD
git_oid pack_oid; /* hash of written pack */
+#endif
+ char *pack_name; /* name of written pack */
/* synchronization objects */
git_mutex cache_mutex;