csum-file: drop `hashfd_throughput()`
The `hashfd_throughput()` function is used by a single callsite in git-pack-objects(1). In contrast to `hashfd()`, this function uses a progress meter to measure throughput and a smaller buffer length so that the progress meter can provide more granular metrics. We're going to change that caller in the next commit to be a bit more specific to packing objects. As such, `hashfd_throughput()` will be a somewhat unfitting mechanism for any potential new callers. Drop the function and replace it with a call to `hashfd_ext()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Mar 13, 2026 at 07:45 UTC
2bf8f36ddb308b084912f8265ad6fd60df34a036
3 files changed
+15
-22
builtin/pack-objects.c
+15
-4
@@ -1331,11 +1331,22 @@ static void write_pack_file(void)
1331
unsigned char hash[GIT_MAX_RAWSZ];
1332
char *pack_tmp_name = NULL;
1333
1334
- if (pack_to_stdout)
1335
- f = hashfd_throughput(the_repository->hash_algo, 1,
1336
- "<stdout>", progress_state);
1337
- else
1334
+ if (pack_to_stdout) {
1335
+ /*
1336
+ * Since we are expecting to report progress of the
1337
+ * write into this hashfile, use a smaller buffer
1338
+ * size so the progress indicators arrive at a more
1339
+ * frequent rate.
1340
+ */
1341
+ struct hashfd_options opts = {
1342
+ .progress = progress_state,
1343
+ .buffer_len = 8 * 1024,
1344
+ };
1345
+ f = hashfd_ext(the_repository->hash_algo, 1,
1346
+ "<stdout>", &opts);
1347
+ } else {
1348
f = create_tmp_packfile(the_repository, &pack_tmp_name);
1349
+ }
1350
1351
offset = write_pack_header(f, nr_remaining);
1352
csum-file.c
-16
@@ -197,22 +197,6 @@ struct hashfile *hashfd(const struct git_hash_algo *algop,
197
return hashfd_ext(algop, fd, name, &opts);
198
}
199
200
-struct hashfile *hashfd_throughput(const struct git_hash_algo *algop,
201
- int fd, const char *name, struct progress *tp)
202
-{
203
- /*
204
- * Since we are expecting to report progress of the
205
- * write into this hashfile, use a smaller buffer
206
- * size so the progress indicators arrive at a more
207
- * frequent rate.
208
- */
209
- struct hashfd_options opts = {
210
- .progress = tp,
211
- .buffer_len = 8 * 1024,
212
- };
213
- return hashfd_ext(algop, fd, name, &opts);
214
-}
215
-
200
void hashfile_checkpoint_init(struct hashfile *f,
201
struct hashfile_checkpoint *checkpoint)
202
{
csum-file.h
-2
@@ -63,8 +63,6 @@ struct hashfile *hashfd(const struct git_hash_algo *algop,
63
int fd, const char *name);
64
struct hashfile *hashfd_check(const struct git_hash_algo *algop,
65
const char *name);
66
-struct hashfile *hashfd_throughput(const struct git_hash_algo *algop,
67
- int fd, const char *name, struct progress *tp);
66
67
/*
68
* Free the hashfile without flushing its contents to disk. This only