From 70d9bfa47c14fd230d081cebb9933622136479ea Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Sat, 22 Jan 2022 17:34:36 -0500 Subject: packbuilder: use the packfile name instead of hash Deprecate the `git_packfile_hash` function. Callers should use the new `git_packfile_name` function which provides a unique packfile name. --- include/git2/pack.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/git2/pack.h b/include/git2/pack.h index 253a860cd..0f6bd2ab9 100644 --- a/include/git2/pack.h +++ b/include/git2/pack.h @@ -170,16 +170,30 @@ GIT_EXTERN(int) git_packbuilder_write( git_indexer_progress_cb progress_cb, void *progress_cb_payload); +#ifndef GIT_DEPRECATE_HARD /** -* Get the packfile's hash -* -* A packfile's name is derived from the sorted hashing of all object -* names. This is only correct after the packfile has been written. -* -* @param pb The packbuilder object + * Get the packfile's hash + * + * A packfile's name is derived from the sorted hashing of all object + * names. This is only correct after the packfile has been written. + * + * @deprecated use git_packbuilder_name + * @param pb The packbuilder object * @return 0 or an error code -*/ + */ GIT_EXTERN(const git_oid *) git_packbuilder_hash(git_packbuilder *pb); +#endif + +/** + * Get the unique name for the resulting packfile. + * + * The packfile's name is derived from the packfile's content. + * This is only correct after the packfile has been written. + * + * @param pb the packbuilder instance + * @return a NUL terminated string for the packfile name + */ +GIT_EXTERN(const char *) git_packbuilder_name(git_packbuilder *pb); /** * Callback used to iterate over packed objects -- cgit v1.2.1