@ -96,7 +96,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
@@ -96,7 +96,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
if (is_gitmodules_unmerged(&the_index))
die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
submodule = submodule_from_path(&null_oid, oldpath);
submodule = submodule_from_path(the_repository, &null_oid, oldpath);
if (!submodule || !submodule->name) {
warning(_("Could not find section in .gitmodules where path=%s"), oldpath);
return -1;
@ -130,7 +130,7 @@ int remove_path_from_gitmodules(const char *path)
@@ -130,7 +130,7 @@ int remove_path_from_gitmodules(const char *path)
if (is_gitmodules_unmerged(&the_index))
die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
submodule = submodule_from_path(&null_oid, path);
submodule = submodule_from_path(the_repository, &null_oid, path);
if (!submodule || !submodule->name) {
warning(_("Could not find section in .gitmodules where path=%s"), path);
return -1;
@ -174,7 +174,8 @@ done:
@@ -174,7 +174,8 @@ done:
void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
const char *path)
{
const struct submodule *submodule = submodule_from_path(&null_oid, path);
const struct submodule *submodule = submodule_from_path(the_repository,
&null_oid, path);
if (submodule) {
const char *ignore;
char *key;
@ -674,7 +675,7 @@ const struct submodule *submodule_from_ce(const struct cache_entry *ce)
@@ -674,7 +675,7 @@ const struct submodule *submodule_from_ce(const struct cache_entry *ce)
if (!should_update_submodules())
return NULL;
return submodule_from_path(&null_oid, ce->name);
return submodule_from_path(the_repository, &null_oid, ce->name);
}
static struct oid_array *submodule_commits(struct string_list *submodules,
@ -731,13 +732,14 @@ static void collect_changed_submodules_cb(struct diff_queue_struct *q,
@@ -731,13 +732,14 @@ static void collect_changed_submodules_cb(struct diff_queue_struct *q,
if (!S_ISGITLINK(p->two->mode))
continue;
submodule = submodule_from_path(commit_oid, p->two->path);
submodule = submodule_from_path(the_repository,
commit_oid, p->two->path);
if (submodule)
name = submodule->name;
else {
name = default_name_or_path(p->two->path);
/* make sure name does not collide with existing one */
submodule = submodule_from_name(commit_oid, name);
submodule = submodule_from_name(the_repository, commit_oid, name);
if (submodule) {
warning("Submodule in commit %s at path: "
"'%s' collides with a submodule named "
@ -945,7 +947,7 @@ int find_unpushed_submodules(struct oid_array *commits,
@@ -945,7 +947,7 @@ int find_unpushed_submodules(struct oid_array *commits,
const struct submodule *submodule;
const char *path = NULL;
submodule = submodule_from_name(&null_oid, name->string);
submodule = submodule_from_name(the_repository, &null_oid, name->string);
if (submodule)
path = submodule->path;
else
@ -1113,7 +1115,7 @@ static void calculate_changed_submodule_paths(void)
@@ -1113,7 +1115,7 @@ static void calculate_changed_submodule_paths(void)
const struct string_list_item *name;
/* No need to check if there are no submodules configured */
if (!submodule_from_path(NULL, NULL))
if (!submodule_from_path(the_repository, NULL, NULL))
return;
argv_array_push(&argv, "--"); /* argv[0] program name */
@ -1134,7 +1136,7 @@ static void calculate_changed_submodule_paths(void)
@@ -1134,7 +1136,7 @@ static void calculate_changed_submodule_paths(void)
const struct submodule *submodule;
const char *path = NULL;
submodule = submodule_from_name(&null_oid, name->string);
submodule = submodule_from_name(the_repository, &null_oid, name->string);
if (submodule)
path = submodule->path;
else
@ -1162,7 +1164,7 @@ int submodule_touches_in_range(struct object_id *excl_oid,
@@ -1162,7 +1164,7 @@ int submodule_touches_in_range(struct object_id *excl_oid,
int ret;
/* No need to check if there are no submodules configured */
if (!submodule_from_path(NULL, NULL))
if (!submodule_from_path(the_repository, NULL, NULL))
return 0;
argv_array_push(&args, "--"); /* args[0] program name */
@ -1604,7 +1606,7 @@ int submodule_move_head(const char *path,
@@ -1604,7 +1606,7 @@ int submodule_move_head(const char *path,
if (old && !is_submodule_populated_gently(path, error_code_ptr))
return 0;
sub = submodule_from_path(&null_oid, path);
sub = submodule_from_path(the_repository, &null_oid, path);
if (!sub)
die("BUG: could not get submodule information for '%s'", path);
@ -1886,7 +1888,7 @@ static void relocate_single_git_dir_into_superproject(const char *prefix,
@@ -1886,7 +1888,7 @@ static void relocate_single_git_dir_into_superproject(const char *prefix,
real_old_git_dir = real_pathdup(old_git_dir, 1);
sub = submodule_from_path(&null_oid, path);
sub = submodule_from_path(the_repository, &null_oid, path);
if (!sub)
die(_("could not lookup name for submodule '%s'"), path);
@ -1942,7 +1944,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
@@ -1942,7 +1944,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
* superproject did not rewrite the git file links yet,
* fix it now.
*/
sub = submodule_from_path(&null_oid, path);
sub = submodule_from_path(the_repository, &null_oid, path);
if (!sub)
die(_("could not lookup name for submodule '%s'"), path);
connect_work_tree_and_git_dir(path,
@ -2088,7 +2090,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule)
@@ -2088,7 +2090,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule)
strbuf_addstr(buf, git_dir);
}
if (!is_git_directory(buf->buf)) {
sub = submodule_from_path(&null_oid, submodule);
sub = submodule_from_path(the_repository, &null_oid, submodule);
if (!sub) {
ret = -1;
goto cleanup;