summaryrefslogtreecommitdiff
path: root/src/libgit2/pack.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-07-11 14:11:15 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2022-07-11 21:36:49 -0400
commit5e44529d206936336e568725aec4fb5fe64138b7 (patch)
treea4ca6d441371d7b146bae5d123100633900de3a7 /src/libgit2/pack.h
parent73deea7e0cef7761588df25c396c156ae901725a (diff)
downloadlibgit2-ethomson/sha256_pack.tar.gz
pack: support SHA256 in packfilesethomson/sha256_pack
Diffstat (limited to 'src/libgit2/pack.h')
-rw-r--r--src/libgit2/pack.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/libgit2/pack.h b/src/libgit2/pack.h
index 6c9dbf20b..1a9eb14b2 100644
--- a/src/libgit2/pack.h
+++ b/src/libgit2/pack.h
@@ -101,9 +101,15 @@ struct git_pack_file {
uint32_t num_bad_objects;
git_oid *bad_object_ids; /* array of git_oid */
+ git_oid_t oid_type;
+ unsigned oid_hexsize:7,
+ oid_size:6,
+ pack_local:1,
+ pack_keep:1,
+ has_cache:1;
+
int index_version;
git_time_t mtime;
- unsigned pack_local:1, pack_keep:1, has_cache:1;
git_oidmap *idx_cache;
unsigned char **ids;
@@ -116,21 +122,22 @@ struct git_pack_file {
};
/**
- * Return the position where an OID (or a prefix) would be inserted within the
- * OID Lookup Table of an .idx file. This performs binary search between the lo
- * and hi indices.
+ * Return the position where an OID (or a prefix) would be inserted within
+ * the OID Lookup Table of an .idx file. This performs binary search
+ * between the lo and hi indices.
*
- * The stride parameter is provided because .idx files version 1 store the OIDs
- * interleaved with the 4-byte file offsets of the objects within the .pack
- * file (stride = 24), whereas files with version 2 store them in a contiguous
- * flat array (stride = 20).
+ * The stride parameter is provided because .idx files version 1 store the
+ * OIDs interleaved with the 4-byte file offsets of the objects within the
+ * .pack file (stride = oid_size + 4), whereas files with version 2 store
+ * them in a contiguous flat array (stride = oid_size).
*/
int git_pack__lookup_id(
const void *id_lookup_table,
size_t stride,
unsigned lo,
unsigned hi,
- const unsigned char *id_prefix);
+ const unsigned char *id_prefix,
+ const git_oid_t oid_type);
struct git_pack_entry {
off64_t offset;
@@ -178,7 +185,10 @@ int get_delta_base(
off64_t delta_obj_offset);
void git_packfile_free(struct git_pack_file *p, bool unlink_packfile);
-int git_packfile_alloc(struct git_pack_file **pack_out, const char *path);
+int git_packfile_alloc(
+ struct git_pack_file **pack_out,
+ const char *path,
+ git_oid_t oid_type);
int git_pack_entry_find(
struct git_pack_entry *e,