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 568508e7657 (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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Apr 15, 2025 at 11:38 UTC 8a54ebd5ed724545811edfb4cd938f53bd25d1ae
2 files changed +17 -24
bulk-checkin.h
+15
@@ -9,6 +9,21 @@
9 void prepare_loose_object_bulk_checkin(void);
10 void fsync_loose_object_bulk_checkin(int fd, const char *filename);
11
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 + */
27 int index_blob_bulk_checkin(struct object_id *oid,
28 int fd, size_t size,
29 const char *path, unsigned flags);
object-file.c
+2 -24
@@ -1356,28 +1356,6 @@ static int index_core(struct index_state *istate,
1356 return ret;
1357 }
1358
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 -
1359 int index_fd(struct index_state *istate, struct object_id *oid,
1360 int fd, struct stat *st,
1361 enum object_type type, const char *path, unsigned flags)
@@ -1398,8 +1376,8 @@ int index_fd(struct index_state *istate, struct object_id *oid,
1376 ret = index_core(istate, oid, fd, xsize_t(st->st_size),
1377 type, path, flags);
1378 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);
1381 close(fd);
1382 return ret;
1383 }