Skip to content

Commit ef7b519

Browse files
bk2204gitster
authored andcommitted
streaming: convert open_istream to use struct object_id
Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 17e6545 commit ef7b519

7 files changed

+9
-9
lines changed

archive-tar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int stream_blocked(const struct object_id *oid)
119119
char buf[BLOCKSIZE];
120120
ssize_t readlen;
121121

122-
st = open_istream(oid->hash, &type, &sz, NULL);
122+
st = open_istream(oid, &type, &sz, NULL);
123123
if (!st)
124124
return error("cannot stream blob %s", oid_to_hex(oid));
125125
for (;;) {

archive-zip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int write_zip_entry(struct archiver_args *args,
337337

338338
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
339339
size > big_file_threshold) {
340-
stream = open_istream(oid->hash, &type, &size, NULL);
340+
stream = open_istream(oid, &type, &size, NULL);
341341
if (!stream)
342342
return error("cannot stream blob %s",
343343
oid_to_hex(oid));

builtin/index-pack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static int check_collison(struct object_entry *entry)
771771

772772
memset(&data, 0, sizeof(data));
773773
data.entry = entry;
774-
data.st = open_istream(entry->idx.oid.hash, &type, &size, NULL);
774+
data.st = open_istream(&entry->idx.oid, &type, &size, NULL);
775775
if (!data.st)
776776
return -1;
777777
if (size != entry->size || type != entry->type)

builtin/pack-objects.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
267267
if (!usable_delta) {
268268
if (entry->type == OBJ_BLOB &&
269269
entry->size > big_file_threshold &&
270-
(st = open_istream(entry->idx.oid.hash, &type, &size, NULL)) != NULL)
270+
(st = open_istream(&entry->idx.oid, &type, &size, NULL)) != NULL)
271271
buf = NULL;
272272
else {
273273
buf = read_sha1_file(entry->idx.oid.hash, &type,

sha1_file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ int check_object_signature(const struct object_id *oid, void *map,
799799
return oidcmp(oid, &real_oid) ? -1 : 0;
800800
}
801801

802-
st = open_istream(oid->hash, &obj_type, &size, NULL);
802+
st = open_istream(oid, &obj_type, &size, NULL);
803803
if (!st)
804804
return -1;
805805

streaming.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ static enum input_source istream_source(const unsigned char *sha1,
130130
}
131131
}
132132

133-
struct git_istream *open_istream(const unsigned char *sha1,
133+
struct git_istream *open_istream(const struct object_id *oid,
134134
enum object_type *type,
135135
unsigned long *size,
136136
struct stream_filter *filter)
137137
{
138138
struct git_istream *st;
139139
struct object_info oi = OBJECT_INFO_INIT;
140-
const unsigned char *real = lookup_replace_object(sha1);
140+
const unsigned char *real = lookup_replace_object(oid->hash);
141141
enum input_source src = istream_source(real, type, &oi);
142142

143143
if (src < 0)
@@ -507,7 +507,7 @@ int stream_blob_to_fd(int fd, const struct object_id *oid, struct stream_filter
507507
ssize_t kept = 0;
508508
int result = -1;
509509

510-
st = open_istream(oid->hash, &type, &sz, filter);
510+
st = open_istream(oid, &type, &sz, filter);
511511
if (!st) {
512512
if (filter)
513513
free_stream_filter(filter);

streaming.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/* opaque */
99
struct git_istream;
1010

11-
extern struct git_istream *open_istream(const unsigned char *, enum object_type *, unsigned long *, struct stream_filter *);
11+
extern struct git_istream *open_istream(const struct object_id *, enum object_type *, unsigned long *, struct stream_filter *);
1212
extern int close_istream(struct git_istream *);
1313
extern ssize_t read_istream(struct git_istream *, void *, size_t);
1414

0 commit comments

Comments
 (0)