Merge branch 'sb/submodule-recursive-fetch-gets-the-tip'

"git fetch --recurse-submodules" may not fetch the necessary commit
that is bound to the superproject, which is getting corrected.

* sb/submodule-recursive-fetch-gets-the-tip:
  fetch: ensure submodule objects fetched
  submodule.c: fetch in submodules git directory instead of in worktree
  submodule: migrate get_next_submodule to use repository structs
  repository: repo_submodule_init to take a submodule struct
  submodule: store OIDs in changed_submodule_names
  submodule.c: tighten scope of changed_submodule_names struct
  submodule.c: sort changed_submodule_names before searching it
  submodule.c: fix indentation
  sha1-array: provide oid_array_filter
This commit is contained in:
Junio C Hamano
2019-01-29 12:47:54 -08:00
12 changed files with 426 additions and 89 deletions

View File

@ -206,17 +206,19 @@ static void show_files(struct repository *repo, struct dir_struct *dir);
static void show_submodule(struct repository *superproject,
struct dir_struct *dir, const char *path)
{
struct repository submodule;
struct repository subrepo;
const struct submodule *sub = submodule_from_path(superproject,
&null_oid, path);
if (repo_submodule_init(&submodule, superproject, path))
if (repo_submodule_init(&subrepo, superproject, sub))
return;
if (repo_read_index(&submodule) < 0)
if (repo_read_index(&subrepo) < 0)
die("index file corrupt");
show_files(&submodule, dir);
show_files(&subrepo, dir);
repo_clear(&submodule);
repo_clear(&subrepo);
}
static void show_ce(struct repository *repo, struct dir_struct *dir,