Merge branch 'rs/merge-recursive-string-list-init' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 9 Sep 2016 04:35:59 +0000 (21:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Sep 2016 04:35:59 +0000 (21:35 -0700)
A small code clean-up.

* rs/merge-recursive-string-list-init:
merge-recursive: use STRING_LIST_INIT_NODUP

1  2 
merge-recursive.c
diff --combined merge-recursive.c
index e7178bcdccc2776947f463bfd9e53000e9d2e0ba,3bba90850f3ee2a27860653e5d08a676820234c7..a52139eadad264296de781a542c474aa7cd62bb6
@@@ -42,9 -42,12 +42,9 @@@ static struct tree *shift_tree_object(s
  static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
  {
        struct commit *commit = alloc_commit_node();
 -      struct merge_remote_desc *desc = xmalloc(sizeof(*desc));
  
 -      desc->name = comment;
 -      desc->obj = (struct object *)commit;
 +      set_merge_remote_desc(commit, comment, (struct object *)commit);
        commit->tree = tree;
 -      commit->util = desc;
        commit->object.parsed = 1;
        return commit;
  }
@@@ -199,21 -202,12 +199,21 @@@ static int add_cacheinfo(unsigned int m
                const char *path, int stage, int refresh, int options)
  {
        struct cache_entry *ce;
 -      ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage,
 -                            (refresh ? (CE_MATCH_REFRESH |
 -                                        CE_MATCH_IGNORE_MISSING) : 0 ));
 +      int ret;
 +
 +      ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, 0);
        if (!ce)
                return error(_("addinfo_cache failed for path '%s'"), path);
 -      return add_cache_entry(ce, options);
 +
 +      ret = add_cache_entry(ce, options);
 +      if (refresh) {
 +              struct cache_entry *nce;
 +
 +              nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
 +              if (nce != ce)
 +                      ret = add_cache_entry(nce, options);
 +      }
 +      return ret;
  }
  
  static void init_tree_desc_from_tree(struct tree_desc *desc, struct tree *tree)
@@@ -406,7 -400,7 +406,7 @@@ static void record_df_conflict_files(st
         * and the file need to be present, then the D/F file will be
         * reinstated with a new unique name at the time it is processed.
         */
-       struct string_list df_sorted_entries;
+       struct string_list df_sorted_entries = STRING_LIST_INIT_NODUP;
        const char *last_file = NULL;
        int last_len = 0;
        int i;
                return;
  
        /* Ensure D/F conflicts are adjacent in the entries list. */
-       memset(&df_sorted_entries, 0, sizeof(struct string_list));
        for (i = 0; i < entries->nr; i++) {
                struct string_list_item *next = &entries->items[i];
                string_list_append(&df_sorted_entries, next->string)->util =