[PATCH 04/21] fixup! index-pack: parse v4 header and dictionaries
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
empty pack case
builtin/index-pack.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 8a6e2a3..89bc708 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1474,7 +1474,8 @@ static void parse_dictionaries(void)
return;
sha1_table = xmalloc(20 * nr_objects_final);
- hashcpy(sha1_table, fill_and_use(20));
+ if (nr_objects_final)
+ hashcpy(sha1_table, fill_and_use(20));
for (i = 1; i < nr_objects_final; i++) {
unsigned char *p = sha1_table + i * 20;
hashcpy(p, fill_and_use(20));
--
1.8.2.82.gc24b958