summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 14:19:13 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-27 20:15:09 -0500
commitd2458af7b7227f0b378e1509d7dfeb958c339590 (patch)
tree66d42fb7f43efd01fe658f4806af50506838b389 /include
parent11ef76a9f5bc04cb61760abebc68e6ac5045bf68 (diff)
downloadlibgit2-d2458af7b7227f0b378e1509d7dfeb958c339590.tar.gz
indexer: use a byte array for checksum
The index's checksum is not an object ID, so we should not use the `git_oid` type. Use a byte array for checksum calculation and storage. Deprecate the `git_indexer_hash` function. Callers should use the new `git_indexer_name` function which provides a unique packfile name.
Diffstat (limited to 'include')
-rw-r--r--include/git2/indexer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/git2/indexer.h b/include/git2/indexer.h
index 4bacbd317..ffe9bf366 100644
--- a/include/git2/indexer.h
+++ b/include/git2/indexer.h
@@ -129,16 +129,30 @@ GIT_EXTERN(int) git_indexer_append(git_indexer *idx, const void *data, size_t si
*/
GIT_EXTERN(int) git_indexer_commit(git_indexer *idx, git_indexer_progress *stats);
+#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 index has been finalized.
*
+ * @deprecated use git_indexer_name
* @param idx the indexer instance
* @return the packfile's hash
*/
GIT_EXTERN(const git_oid *) git_indexer_hash(const git_indexer *idx);
+#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 index has been finalized.
+ *
+ * @param idx the indexer instance
+ * @return a NUL terminated string for the packfile name
+ */
+GIT_EXTERN(const char *) git_indexer_name(const git_indexer *idx);
/**
* Free the indexer and its resources