diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-04-14 17:35:08 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-04-16 12:38:58 +0900 |
| commit | 660b373542589157aff78dd37ce582237027ba94 (patch) | |
| tree | f67357eae9d26abec3f578157627cf5aa0106602 /builtin/pack-objects.c | |
| parent | 0cb3c1427a1e9cee638e0c1629933c907493d7e3 (diff) | |
| download | git-660b373542589157aff78dd37ce582237027ba94.tar.gz | |
pack-objects: don't check size when the object is bad
sha1_object_info() in check_objects() may fail to locate an object in
the pack and return type OBJ_BAD. In that case, it will likely leave
the "size" field untouched. We delay error handling until later in
prepare_pack() though. Until then, do not touch "size" field.
This field should contain the default value zero, but we can't say
sha1_object_info() cannot damage it. This becomes more important later
when the object size may have to be retrieved back from the
(non-existing) pack.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
| -rw-r--r-- | builtin/pack-objects.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 211bb1ad0e..e75693176e 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1742,7 +1742,7 @@ static void get_object_details(void) for (i = 0; i < to_pack.nr_objects; i++) { struct object_entry *entry = sorted_by_offset[i]; check_object(entry); - if (big_file_threshold < entry->size) + if (entry->type_valid && big_file_threshold < entry->size) entry->no_try_delta = 1; } @@ -2453,7 +2453,7 @@ static void prepare_pack(int window, int depth) */ continue; - if (entry->size < 50) + if (!entry->type_valid || entry->size < 50) continue; if (entry->no_try_delta) |
