pack-objects: drop unused return value from add_object_entry()

This function returns 0/1 to its caller to tell them whether we actually added a new entry (or if we considered it redundant). But nobody has relied on that behavior since 5379a5c5ee (Thin pack generation: optimization., 2006-04-05). The extra return does not hurt much, but it is a bit confusing. We have a sister function, add_object_entry_from_bitmap(), which has the same return value semantics. That function is about to change to always return 0 (not void, because it must conform to a callback function interface). So with that change, we'd have two related functions which both return an "int" but with different semantics. Let's drop the unused "int" return from add_object_entry() entirely, which makes it more clear that the two functions have diverged. Signed-off-by: Jeff King <peff@peff.net> [ps: slightly massaged the commit message] Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 15, 2026 at 08:22 UTC 6f48b8ce56171419f768902b300365c1b6708c96
1 file changed +4 -5
builtin/pack-objects.c
+4 -5
@@ -1867,8 +1867,8 @@ static const char no_closure_warning[] = N_(
1867 "disabling bitmap writing, as some objects are not being packed"
1868 );
1869
1870 -static int add_object_entry(const struct object_id *oid, enum object_type type,
1871 - const char *name, int exclude)
1870 +static void add_object_entry(const struct object_id *oid, enum object_type type,
1871 + const char *name, int exclude)
1872 {
1873 struct packed_git *found_pack = NULL;
1874 off_t found_offset = 0;
@@ -1876,7 +1876,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
1876 display_progress(progress_state, ++nr_seen);
1877
1878 if (have_duplicate_entry(oid, exclude))
1879 - return 0;
1879 + return;
1880
1881 if (!want_object_in_pack(oid, exclude, &found_pack, &found_offset)) {
1882 /* The pack is missing an object, so it will not have closure */
@@ -1885,13 +1885,12 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
1885 warning(_(no_closure_warning));
1886 write_bitmap_index = 0;
1887 }
1888 - return 0;
1888 + return;
1889 }
1890
1891 create_object_entry(oid, type, pack_name_hash_fn(name),
1892 exclude, name && no_try_delta(name),
1893 found_pack, found_offset);
1894 - return 1;
1894 }
1895
1896 static int add_object_entry_from_bitmap(const struct object_id *oid,