Merge branch 'jk/delta-islands-progress-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)
The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.

* jk/delta-islands-progress-fix:
delta-islands: respect progress flag

1  2 
builtin/pack-objects.c
diff --combined builtin/pack-objects.c
index b2be8869c236378ca70517d2c7431a6993952a3c,15f90afc34f49ec2fa5219864e12af169c2b7e7b..698c9015230012f9c6d736e6f3f510e97f4569d3
@@@ -33,7 -33,6 +33,7 @@@
  #include "object-store.h"
  #include "dir.h"
  #include "midx.h"
 +#include "trace2.h"
  
  #define IN_PACK(obj) oe_in_pack(&to_pack, obj)
  #define SIZE(obj) oe_size(&to_pack, obj)
@@@ -97,7 -96,7 +97,7 @@@ static off_t reuse_packfile_offset
  static int use_bitmap_index_default = 1;
  static int use_bitmap_index = -1;
  static int write_bitmap_index;
 -static uint16_t write_bitmap_options;
 +static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
  
  static int exclude_promisor_objects;
  
@@@ -964,8 -963,6 +964,8 @@@ static void write_pack_file(void
        if (written != nr_result)
                die(_("wrote %"PRIu32" objects while expecting %"PRIu32),
                    written, nr_result);
 +      trace2_data_intmax("pack-objects", the_repository,
 +                         "write_pack_file/wrote", nr_result);
  }
  
  static int no_try_delta(const char *path)
@@@ -1080,7 -1077,7 +1080,7 @@@ static int want_object_in_pack(const st
  
        for (m = get_multi_pack_index(the_repository); m; m = m->next) {
                struct pack_entry e;
 -              if (fill_midx_entry(oid, &e, m)) {
 +              if (fill_midx_entry(the_repository, oid, &e, m)) {
                        struct packed_git *p = e.p;
                        off_t offset;
  
@@@ -1489,7 -1486,6 +1489,7 @@@ static int can_reuse_delta(const unsign
                           struct object_entry **base_out)
  {
        struct object_entry *base;
 +      struct object_id base_oid;
  
        if (!base_sha1)
                return 0;
         * even if it was buried too deep in history to make it into the
         * packing list.
         */
 -      if (thin && bitmap_has_sha1_in_uninteresting(bitmap_git, base_sha1)) {
 +      oidread(&base_oid, base_sha1);
 +      if (thin && bitmap_has_oid_in_uninteresting(bitmap_git, &base_oid)) {
                if (use_delta_islands) {
 -                      struct object_id base_oid;
 -                      hashcpy(base_oid.hash, base_sha1);
                        if (!in_same_island(&delta->idx.oid, &base_oid))
                                return 0;
                }
@@@ -2899,7 -2896,7 +2899,7 @@@ static int ofscmp(const void *a_, cons
                return oidcmp(&a->object->oid, &b->object->oid);
  }
  
 -static void add_objects_in_unpacked_packs(struct rev_info *revs)
 +static void add_objects_in_unpacked_packs(void)
  {
        struct packed_git *p;
        struct in_pack in_pack;
@@@ -3011,7 -3008,7 +3011,7 @@@ static int loosened_object_can_be_disca
        return 1;
  }
  
 -static void loosen_unused_packed_objects(struct rev_info *revs)
 +static void loosen_unused_packed_objects(void)
  {
        struct packed_git *p;
        uint32_t i;
@@@ -3134,7 -3131,7 +3134,7 @@@ static void get_object_list(int ac, con
                return;
  
        if (use_delta_islands)
-               load_delta_islands(the_repository);
+               load_delta_islands(the_repository, progress);
  
        if (prepare_revision_walk(&revs))
                die(_("revision walk setup failed"));
        }
  
        if (keep_unreachable)
 -              add_objects_in_unpacked_packs(&revs);
 +              add_objects_in_unpacked_packs();
        if (pack_loose_unreachable)
                add_unreachable_loose_objects();
        if (unpack_unreachable)
 -              loosen_unused_packed_objects(&revs);
 +              loosen_unused_packed_objects();
  
        oid_array_clear(&recent_objects);
  }
@@@ -3476,8 -3473,6 +3476,8 @@@ int cmd_pack_objects(int argc, const ch
                }
        }
  
 +      trace2_region_enter("pack-objects", "enumerate-objects",
 +                          the_repository);
        prepare_packing_data(the_repository, &to_pack);
  
        if (progress)
        if (include_tag && nr_result)
                for_each_ref(add_ref_tag, NULL);
        stop_progress(&progress_state);
 +      trace2_region_leave("pack-objects", "enumerate-objects",
 +                          the_repository);
  
        if (non_empty && !nr_result)
                return 0;
 -      if (nr_result)
 +      if (nr_result) {
 +              trace2_region_enter("pack-objects", "prepare-pack",
 +                                  the_repository);
                prepare_pack(window, depth);
 +              trace2_region_leave("pack-objects", "prepare-pack",
 +                                  the_repository);
 +      }
 +
 +      trace2_region_enter("pack-objects", "write-pack-file", the_repository);
        write_pack_file();
 +      trace2_region_leave("pack-objects", "write-pack-file", the_repository);
 +
        if (progress)
                fprintf_ln(stderr,
                           _("Total %"PRIu32" (delta %"PRIu32"),"