Skip to content

Commit 3745eb0

Browse files
committed
fixup! Hydrate missing loose objects in check_and_freshen()
If the `read-object` hook is not found, the code currently would fail with the rather obscure message: fatal: Out of memory, strdup failed The reason is because without a check whether the hook was found, eventually `strvec_push()` would try to call `xstrdup()` with `cmd` (which is `NULL` if the hook was not found) which would fail and print that rather misleading message. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 244d3fc commit 3745eb0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

odb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ int read_object_process(struct repository *r, const struct object_id *oid)
725725
const char *cmd = find_hook(r, "read-object");
726726
uint64_t start;
727727

728+
if (!cmd)
729+
die(_("could not find the `read-object` hook"));
730+
728731
start = getnanotime();
729732

730733
trace2_region_enter("subprocess", "read_object",r);

0 commit comments

Comments
 (0)