aboutsummaryrefslogtreecommitdiffstats
path: root/archive-zip.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-12-16 11:08:34 +0900
committerJunio C Hamano <gitster@pobox.com>2025-12-16 11:08:34 +0900
commitdbe54273a707406409fa386db5b105557b31a831 (patch)
tree0def4e76638eff5ca5628d3cb2d0acb157c7bf37 /archive-zip.c
parentd8af7cadaa79d5837d73ec949e10b57dedb43e9b (diff)
parent7b940286527ec2175dffbb317f47e080bb37cf3e (diff)
downloadgit-dbe54273a707406409fa386db5b105557b31a831.tar.gz
Merge branch 'ps/object-read-stream'
The "git_istream" abstraction has been revamped to make it easier to interface with pluggable object database design. * ps/object-read-stream: streaming: drop redundant type and size pointers streaming: move into object database subsystem streaming: refactor interface to be object-database-centric streaming: move logic to read packed objects streams into backend streaming: move logic to read loose objects streams into backend streaming: make the `odb_read_stream` definition public streaming: get rid of `the_repository` streaming: rely on object sources to create object stream packfile: introduce function to read object info from a store streaming: move zlib stream into backends streaming: create structure for filtered object streams streaming: create structure for packed object streams streaming: create structure for loose object streams streaming: create structure for in-core object streams streaming: allocate stream inside the backend-specific logic streaming: explicitly pass packfile info when streaming a packed object streaming: propagate final object type via the stream streaming: drop the `open()` callback function streaming: rename `git_istream` into `odb_read_stream`
Diffstat (limited to 'archive-zip.c')
-rw-r--r--archive-zip.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/archive-zip.c b/archive-zip.c
index bea5bdd43d..97ea8d60d6 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -10,9 +10,9 @@
#include "gettext.h"
#include "git-zlib.h"
#include "hex.h"
-#include "streaming.h"
#include "utf8.h"
#include "odb.h"
+#include "odb/streaming.h"
#include "strbuf.h"
#include "userdiff.h"
#include "write-or-die.h"
@@ -309,7 +309,7 @@ static int write_zip_entry(struct archiver_args *args,
enum zip_method method;
unsigned char *out;
void *deflated = NULL;
- struct git_istream *stream = NULL;
+ struct odb_read_stream *stream = NULL;
unsigned long flags = 0;
int is_binary = -1;
const char *path_without_prefix = path + args->baselen;
@@ -347,12 +347,11 @@ static int write_zip_entry(struct archiver_args *args,
method = ZIP_METHOD_DEFLATE;
if (!buffer) {
- enum object_type type;
- stream = open_istream(args->repo, oid, &type, &size,
- NULL);
+ stream = odb_read_stream_open(args->repo->objects, oid, NULL);
if (!stream)
return error(_("cannot stream blob %s"),
oid_to_hex(oid));
+ size = stream->size;
flags |= ZIP_STREAM;
out = NULL;
} else {
@@ -429,7 +428,7 @@ static int write_zip_entry(struct archiver_args *args,
ssize_t readlen;
for (;;) {
- readlen = read_istream(stream, buf, sizeof(buf));
+ readlen = odb_read_stream_read(stream, buf, sizeof(buf));
if (readlen <= 0)
break;
crc = crc32(crc, buf, readlen);
@@ -439,7 +438,7 @@ static int write_zip_entry(struct archiver_args *args,
buf, readlen);
write_or_die(1, buf, readlen);
}
- close_istream(stream);
+ odb_read_stream_close(stream);
if (readlen)
return readlen;
@@ -462,7 +461,7 @@ static int write_zip_entry(struct archiver_args *args,
zstream.avail_out = sizeof(compressed);
for (;;) {
- readlen = read_istream(stream, buf, sizeof(buf));
+ readlen = odb_read_stream_read(stream, buf, sizeof(buf));
if (readlen <= 0)
break;
crc = crc32(crc, buf, readlen);
@@ -486,7 +485,7 @@ static int write_zip_entry(struct archiver_args *args,
}
}
- close_istream(stream);
+ odb_read_stream_close(stream);
if (readlen)
return readlen;