summaryrefslogtreecommitdiff
path: root/src/midx.h
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2020-02-16 02:00:56 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2020-11-27 11:40:02 +0000
commitf847fa7b34abdc7850b8739747e1d25eefafa5f2 (patch)
treeac8b28e09c7563a05196f4d354e065b5faaafc0a /src/midx.h
parentfa618a595bff675fa1d001dc9d57f8fd6c1b052e (diff)
downloadlibgit2-f847fa7b34abdc7850b8739747e1d25eefafa5f2.tar.gz
midx: Support multi-pack-index files in odb_pack.c
This change adds support for reading multi-pack-index files from the packfile odb backend. This also makes git_pack_file objects open their backing failes lazily in more scenarios, since the multi-pack-index can avoid having to open them in some cases (yay!). This change also refreshes the documentation found in src/odb_pack.c to match the updated code. Part of: #5399
Diffstat (limited to 'src/midx.h')
-rw-r--r--src/midx.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/midx.h b/src/midx.h
index 3b802952c..543ff2178 100644
--- a/src/midx.h
+++ b/src/midx.h
@@ -14,6 +14,7 @@
#include "map.h"
#include "mwindow.h"
+#include "odb.h"
/*
* A multi-pack-index file.
@@ -49,6 +50,9 @@ typedef struct git_midx_file {
/* The trailer of the file. Contains the SHA1-checksum of the whole file. */
git_oid checksum;
+
+ /* something like ".git/objects/pack/multi-pack-index". */
+ git_buf filename;
} git_midx_file;
/*
@@ -66,11 +70,18 @@ typedef struct git_midx_entry {
int git_midx_open(
git_midx_file **idx_out,
const char *path);
+bool git_midx_needs_refresh(
+ const git_midx_file *idx,
+ const char *path);
int git_midx_entry_find(
git_midx_entry *e,
git_midx_file *idx,
const git_oid *short_oid,
size_t len);
+int git_midx_foreach_entry(
+ git_midx_file *idx,
+ git_odb_foreach_cb cb,
+ void *data);
int git_midx_close(git_midx_file *idx);
void git_midx_free(git_midx_file *idx);