Merge branch 'jc/submodule-anchor-git-dir' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)
Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.

* jc/submodule-anchor-git-dir:
submodule: avoid auto-discovery in prepare_submodule_repo_env()

1  2 
submodule.c
diff --combined submodule.c
index 1b5cdfb7e784d646c15e59afb2fb43587a8ff8e9,2801fbbe1483a0ee1eea058c99b757da8b465122..e8258f061ac5726d8001a5b207886b3191745eaa
@@@ -17,7 -17,7 +17,7 @@@
  
  static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
  static int parallel_jobs = 1;
 -static struct string_list changed_submodule_paths;
 +static struct string_list changed_submodule_paths = STRING_LIST_INIT_NODUP;
  static int initialized_fetch_ref_tips;
  static struct sha1_array ref_tips_before_fetch;
  static struct sha1_array ref_tips_after_fetch;
@@@ -445,7 -445,7 +445,7 @@@ static void collect_submodules_from_dif
                struct diff_filepair *p = q->queue[i];
                if (!S_ISGITLINK(p->two->mode))
                        continue;
 -              if (submodule_needs_pushing(p->two->path, p->two->sha1))
 +              if (submodule_needs_pushing(p->two->path, p->two->oid.hash))
                        string_list_insert(needs_pushing, p->two->path);
        }
  }
@@@ -577,7 -577,7 +577,7 @@@ static void submodule_collect_changed_c
                         * being moved around. */
                        struct string_list_item *path;
                        path = unsorted_string_list_lookup(&changed_submodule_paths, p->two->path);
 -                      if (!path && !is_submodule_commit_present(p->two->path, p->two->sha1))
 +                      if (!path && !is_submodule_commit_present(p->two->path, p->two->oid.hash))
                                string_list_append(&changed_submodule_paths, xstrdup(p->two->path));
                } else {
                        /* Submodule is new or was moved here */
@@@ -1160,4 -1160,5 +1160,5 @@@ void prepare_submodule_repo_env(struct 
                if (strcmp(*var, CONFIG_DATA_ENVIRONMENT))
                        argv_array_push(out, *var);
        }
+       argv_array_push(out, "GIT_DIR=.git");
  }