Merge branch 'mh/fast-import-notes-fix-new'
authorJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 23:24:26 +0000 (15:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 23:24:26 +0000 (15:24 -0800)
"git fast-import" sometimes mishandled while rebalancing notes
tree, which has been fixed.

* mh/fast-import-notes-fix-new:
fast-import: properly fanout notes when tree is imported

1  2 
fast-import.c
diff --combined fast-import.c
index f561ba833bd75b87f1786281813ad40ecc107e95,5e528b199971587665caa37faf628071abb8e2a9..64fe602f0bb62c4848798d1bdb43a7be9ab5f523
@@@ -284,6 -284,8 +284,6 @@@ static unsigned long max_depth = 10
  static off_t max_packsize;
  static int unpack_limit = 100;
  static int force_update;
 -static int pack_compression_level = Z_DEFAULT_COMPRESSION;
 -static int pack_compression_seen;
  
  /* Stats and misc. counters */
  static uintmax_t alloc_count;
@@@ -2218,13 -2220,17 +2218,17 @@@ static uintmax_t do_change_note_fanout
                char *fullpath, unsigned int fullpath_len,
                unsigned char fanout)
  {
-       struct tree_content *t = root->tree;
+       struct tree_content *t;
        struct tree_entry *e, leaf;
        unsigned int i, tmp_hex_sha1_len, tmp_fullpath_len;
        uintmax_t num_notes = 0;
        unsigned char sha1[20];
        char realpath[60];
  
+       if (!root->tree)
+               load_tree(root);
+       t = root->tree;
        for (i = 0; t && i < t->entry_count; i++) {
                e = t->entries[i];
                tmp_hex_sha1_len = hex_sha1_len + e->name->str_len;
                                leaf.tree);
                } else if (S_ISDIR(e->versions[1].mode)) {
                        /* This is a subdir that may contain note entries */
-                       if (!e->tree)
-                               load_tree(e);
                        num_notes += do_change_note_fanout(orig_root, e,
                                hex_sha1, tmp_hex_sha1_len,
                                fullpath, tmp_fullpath_len, fanout);
@@@ -3379,6 -3383,15 +3381,6 @@@ static void git_pack_config(void
                if (max_depth > MAX_DEPTH)
                        max_depth = MAX_DEPTH;
        }
 -      if (!git_config_get_int("pack.compression", &pack_compression_level)) {
 -              if (pack_compression_level == -1)
 -                      pack_compression_level = Z_DEFAULT_COMPRESSION;
 -              else if (pack_compression_level < 0 ||
 -                       pack_compression_level > Z_BEST_COMPRESSION)
 -                      git_die_config("pack.compression",
 -                                      "bad pack compression level %d", pack_compression_level);
 -              pack_compression_seen = 1;
 -      }
        if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
                pack_idx_opts.version = indexversion_value;
                if (pack_idx_opts.version > 2)
@@@ -3443,6 -3456,8 +3445,6 @@@ int cmd_main(int argc, const char **arg
        setup_git_directory();
        reset_pack_idx_option(&pack_idx_opts);
        git_pack_config();
 -      if (!pack_compression_seen && core_compression_seen)
 -              pack_compression_level = core_compression_level;
  
        alloc_objects(object_entry_alloc);
        strbuf_init(&command_buf, 0);