summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2020-02-17 21:28:13 +0000
committerlhchavez <lhchavez@lhchavez.com>2021-07-26 18:49:18 -0700
commitfff209c400dc054aa05575aa726fd0f03de788c5 (patch)
tree7954a78f26f450236505bbd5bc307fab83586582 /src/pack.h
parent2370e4910262f941a3bb0f70ce05ff7a90679fe1 (diff)
downloadlibgit2-fff209c400dc054aa05575aa726fd0f03de788c5.tar.gz
midx: Add a way to write multi-pack-index files
This change adds the git_midx_writer_* functions to allow to write and create `multi-pack-index` files from `.idx`/`.pack` files. Part of: #5399
Diffstat (limited to 'src/pack.h')
-rw-r--r--src/pack.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index 1d077240d..8aea7d8f9 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -20,6 +20,14 @@
#include "oidmap.h"
#include "zstream.h"
+/**
+ * Function type for callbacks from git_pack_foreach_entry_offset.
+ */
+typedef int GIT_CALLBACK(git_pack_foreach_entry_offset_cb)(
+ const git_oid *id,
+ off64_t offset,
+ void *payload);
+
#define GIT_PACK_FILE_MODE 0444
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
@@ -176,5 +184,13 @@ int git_pack_foreach_entry(
struct git_pack_file *p,
git_odb_foreach_cb cb,
void *data);
+/**
+ * Similar to git_pack_foreach_entry, but it also provides the offset of the
+ * object within the packfile. It also does not sort the objects in any order.
+ */
+int git_pack_foreach_entry_offset(
+ struct git_pack_file *p,
+ git_pack_foreach_entry_offset_cb cb,
+ void *data);
#endif