Skip to content

Commit 413202c

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 6e437e9 commit 413202c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

object-store.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,9 @@ int read_object_process(const struct object_id *oid)
707707
const char *cmd = find_hook(the_repository, "read-object");
708708
uint64_t start;
709709

710+
if (!cmd)
711+
die(_("could not find the `read-object` hook"));
712+
710713
start = getnanotime();
711714

712715
trace2_region_enter("subprocess", "read_object", the_repository);

0 commit comments

Comments
 (0)