Merge branch 'jk/index-pack-correct-depth-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2013 16:06:19 +0000 (1 09:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2013 16:06:19 +0000 (1 09:06 -0700)
"index-pack --fix-thin" used uninitialize value to compute delta
depths of objects it appends to the resulting pack.

* jk/index-pack-correct-depth-fix:
  index-pack: always zero-initialize object_entry list

1  2 
builtin/index-pack.c

@@@ -1107,12 -1106,13 +1107,14 @@@ static void conclude_pack(int fix_thin_
                objects = xrealloc(objects,
                                   (nr_objects + nr_unresolved + 1)
                                   * sizeof(*objects));
+               memset(objects + nr_objects + 1, 0,
+                      nr_unresolved * sizeof(*objects));
                f = sha1fd(output_fd, curr_pack);
                fix_unresolved_deltas(f, nr_unresolved);
 -              sprintf(msg, "completed with %d local objects",
 -                      nr_objects - nr_objects_initial);
 -              stop_progress_msg(&progress, msg);
 +              strbuf_addf(&msg, _("completed with %d local objects"),
 +                          nr_objects - nr_objects_initial);
 +              stop_progress_msg(&progress, msg.buf);
 +              strbuf_release(&msg);
                sha1close(f, tail_sha1, 0);
                hashcpy(read_sha1, pack_sha1);
                fixup_pack_header_footer(output_fd, pack_sha1,