mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-05 17:40:24 -05:00
Merge branch 'jt/odb-transaction-write' into ps/odb-in-memory
* jt/odb-transaction-write: odb/transaction: make `write_object_stream()` pluggable object-file: generalize packfile writes to use odb_write_stream object-file: avoid fd seekback by checking object size upfront object-file: remove flags from transaction packfile writes odb: update `struct odb_write_stream` read() callback odb/transaction: use pluggable `begin_transaction()` odb: split `struct odb_transaction` into separate header
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include "hex.h"
|
||||
#include "object-file.h"
|
||||
#include "odb.h"
|
||||
#include "odb/streaming.h"
|
||||
#include "odb/transaction.h"
|
||||
#include "object.h"
|
||||
#include "delta.h"
|
||||
#include "pack.h"
|
||||
@@ -359,24 +361,21 @@ static void unpack_non_delta_entry(enum object_type type, unsigned long size,
|
||||
|
||||
struct input_zstream_data {
|
||||
git_zstream *zstream;
|
||||
unsigned char buf[8192];
|
||||
int status;
|
||||
};
|
||||
|
||||
static const void *feed_input_zstream(struct odb_write_stream *in_stream,
|
||||
unsigned long *readlen)
|
||||
static ssize_t feed_input_zstream(struct odb_write_stream *in_stream,
|
||||
unsigned char *buf, size_t buf_len)
|
||||
{
|
||||
struct input_zstream_data *data = in_stream->data;
|
||||
git_zstream *zstream = data->zstream;
|
||||
void *in = fill(1);
|
||||
|
||||
if (in_stream->is_finished) {
|
||||
*readlen = 0;
|
||||
return NULL;
|
||||
}
|
||||
if (in_stream->is_finished)
|
||||
return 0;
|
||||
|
||||
zstream->next_out = data->buf;
|
||||
zstream->avail_out = sizeof(data->buf);
|
||||
zstream->next_out = buf;
|
||||
zstream->avail_out = buf_len;
|
||||
zstream->next_in = in;
|
||||
zstream->avail_in = len;
|
||||
|
||||
@@ -384,9 +383,7 @@ static const void *feed_input_zstream(struct odb_write_stream *in_stream,
|
||||
|
||||
in_stream->is_finished = data->status != Z_OK;
|
||||
use(len - zstream->avail_in);
|
||||
*readlen = sizeof(data->buf) - zstream->avail_out;
|
||||
|
||||
return data->buf;
|
||||
return buf_len - zstream->avail_out;
|
||||
}
|
||||
|
||||
static void stream_blob(unsigned long size, unsigned nr)
|
||||
|
||||
Reference in New Issue
Block a user