object-file: drop support for writing objects with unknown types

Since "hash-object --literally" no longer supports objects with unknown
types, there are now no callers of write_object_file_literally() and its
helpers. Let's drop them to simplify the code.

In particular, this gets rid of some ugly copy-and-paste code from
write_object_file_literally(), which is a parallel implementation of
write_object_file(). When the split was originally made, the two weren't
that long, but commits like 63a6745a07 (object-file: update the loose
object map when writing loose objects, 2023-10-01) ended up having to
duplicate some tricky code.

This patch drops all of that duplication and should make things less
error-prone going forward.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2025-05-16 00:50:13 -04:00
committed by Junio C Hamano
parent f710fd7b49
commit 141f8c8c05
2 changed files with 6 additions and 80 deletions

View File

@@ -159,7 +159,7 @@ int parse_loose_header(const char *hdr, struct object_info *oi);
enum {
/*
* By default, `write_object_file_literally()` does not actually write
* By default, `write_object_file()` does not actually write
* anything into the object store, but only computes the object ID.
* This flag changes that so that the object will be written as a loose
* object and persisted.
@@ -187,9 +187,6 @@ struct input_stream {
int is_finished;
};
int write_object_file_literally(const void *buf, unsigned long len,
const char *type, struct object_id *oid,
unsigned flags);
int stream_loose_object(struct input_stream *in_stream, size_t len,
struct object_id *oid);