Skip to content

Commit 8a54ebd

Browse files
pks-tgitster
authored andcommitted
object-file: drop index_blob_stream()
The `index_blob_stream()` function is a mere wrapper around `index_blob_bulk_checkin()`. This has been the case since 568508e (bulk-checkin: replace fast-import based implementation, 2011-10-28), which has moved the implementation from `index_blob_stream()` (which was still called `index_stream()`) into `index_bulk_checkin()` (which has since been renamed to `index_blob_bulk_checkin()`). Remove the redirection by dropping the wrapper. Move the comment to `index_blob_bulk_checkin()` to retain its context. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 70c0f9d commit 8a54ebd

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

bulk-checkin.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@
99
void prepare_loose_object_bulk_checkin(void);
1010
void fsync_loose_object_bulk_checkin(int fd, const char *filename);
1111

12+
/*
13+
* This creates one packfile per large blob unless bulk-checkin
14+
* machinery is "plugged".
15+
*
16+
* This also bypasses the usual "convert-to-git" dance, and that is on
17+
* purpose. We could write a streaming version of the converting
18+
* functions and insert that before feeding the data to fast-import
19+
* (or equivalent in-core API described above). However, that is
20+
* somewhat complicated, as we do not know the size of the filter
21+
* result, which we need to know beforehand when writing a git object.
22+
* Since the primary motivation for trying to stream from the working
23+
* tree file and to avoid mmaping it in core is to deal with large
24+
* binary blobs, they generally do not want to get any conversion, and
25+
* callers should avoid this code path when filters are requested.
26+
*/
1227
int index_blob_bulk_checkin(struct object_id *oid,
1328
int fd, size_t size,
1429
const char *path, unsigned flags);

object-file.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,28 +1356,6 @@ static int index_core(struct index_state *istate,
13561356
return ret;
13571357
}
13581358

1359-
/*
1360-
* This creates one packfile per large blob unless bulk-checkin
1361-
* machinery is "plugged".
1362-
*
1363-
* This also bypasses the usual "convert-to-git" dance, and that is on
1364-
* purpose. We could write a streaming version of the converting
1365-
* functions and insert that before feeding the data to fast-import
1366-
* (or equivalent in-core API described above). However, that is
1367-
* somewhat complicated, as we do not know the size of the filter
1368-
* result, which we need to know beforehand when writing a git object.
1369-
* Since the primary motivation for trying to stream from the working
1370-
* tree file and to avoid mmaping it in core is to deal with large
1371-
* binary blobs, they generally do not want to get any conversion, and
1372-
* callers should avoid this code path when filters are requested.
1373-
*/
1374-
static int index_blob_stream(struct object_id *oid, int fd, size_t size,
1375-
const char *path,
1376-
unsigned flags)
1377-
{
1378-
return index_blob_bulk_checkin(oid, fd, size, path, flags);
1379-
}
1380-
13811359
int index_fd(struct index_state *istate, struct object_id *oid,
13821360
int fd, struct stat *st,
13831361
enum object_type type, const char *path, unsigned flags)
@@ -1398,8 +1376,8 @@ int index_fd(struct index_state *istate, struct object_id *oid,
13981376
ret = index_core(istate, oid, fd, xsize_t(st->st_size),
13991377
type, path, flags);
14001378
else
1401-
ret = index_blob_stream(oid, fd, xsize_t(st->st_size), path,
1402-
flags);
1379+
ret = index_blob_bulk_checkin(oid, fd, xsize_t(st->st_size), path,
1380+
flags);
14031381
close(fd);
14041382
return ret;
14051383
}

0 commit comments

Comments
 (0)