Merge branch 'km/fetch-do-not-free-remote-name' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:44:10 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:44:10 +0000 (10:44 -0700)
The ownership rule for the piece of memory that hold references to
be fetched in "git fetch" was screwy, which has been cleaned up.

* km/fetch-do-not-free-remote-name:
builtin/fetch.c: don't free remote->name after fetch

1  2 
builtin/fetch.c
diff --combined builtin/fetch.c
index 1582ca71847fe4d79366e85cbea86f9f64f55b90,377a68514ac40dd8b3f5336eb9996b12a88eec68..f896aa1f881a0fd320999803fbf4770930342d49
@@@ -37,7 -37,7 +37,7 @@@ static int prune = -1; /* unspecified *
  static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity;
  static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
  static int tags = TAGS_DEFAULT, unshallow, update_shallow;
 -static int max_children = 1;
 +static int max_children = -1;
  static enum transport_family family;
  static const char *depth;
  static const char *upload_pack;
@@@ -607,7 -607,7 +607,7 @@@ static int store_updated_refs(const cha
  
        fp = fopen(filename, "a");
        if (!fp)
 -              return error(_("cannot open %s: %s\n"), filename, strerror(errno));
 +              return error_errno(_("cannot open %s"), filename);
  
        if (raw_url)
                url = transport_anonymize_url(raw_url);
@@@ -848,7 -848,7 +848,7 @@@ static int truncate_fetch_head(void
        FILE *fp = fopen_for_writing(filename);
  
        if (!fp)
 -              return error(_("cannot open %s: %s\n"), filename, strerror(errno));
 +              return error_errno(_("cannot open %s"), filename);
        fclose(fp);
        return 0;
  }
@@@ -1005,7 -1005,7 +1005,7 @@@ static int get_remote_group(const char 
                        size_t wordlen = strcspn(value, " \t\n");
  
                        if (wordlen >= 1)
-                               string_list_append(g->list,
+                               string_list_append_nodup(g->list,
                                                   xstrndup(value, wordlen));
                        value += wordlen + (value[wordlen] != '\0');
                }
@@@ -1143,7 -1143,7 +1143,7 @@@ static int fetch_one(struct remote *rem
  int cmd_fetch(int argc, const char **argv, const char *prefix)
  {
        int i;
-       struct string_list list = STRING_LIST_INIT_NODUP;
+       struct string_list list = STRING_LIST_INIT_DUP;
        struct remote *remote;
        int result = 0;
        struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
                argv_array_clear(&options);
        }
  
-       /* All names were strdup()ed or strndup()ed */
-       list.strdup_strings = 1;
        string_list_clear(&list, 0);
  
        close_all_packs();