summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/submodule.c b/submodule.c
index ab99a30253..74d5766f07 100644
--- a/submodule.c
+++ b/submodule.c
@@ -159,7 +159,7 @@ int remove_path_from_gitmodules(const char *path)
}
strbuf_addstr(&sect, "submodule.");
strbuf_addstr(&sect, submodule->name);
- if (git_config_rename_section_in_file(GITMODULES_FILE, sect.buf, NULL) < 0) {
+ if (repo_config_rename_section_in_file(the_repository, GITMODULES_FILE, sect.buf, NULL) < 0) {
/* Maybe the user already did that, don't error out here */
warning(_("Could not remove .gitmodules entry for %s"), path);
strbuf_release(&sect);
@@ -175,11 +175,11 @@ void stage_updated_gitmodules(struct index_state *istate)
die(_("staging updated .gitmodules failed"));
}
-static struct string_list added_submodule_odb_paths = STRING_LIST_INIT_NODUP;
+static struct string_list added_submodule_odb_paths = STRING_LIST_INIT_DUP;
void add_submodule_odb_by_path(const char *path)
{
- string_list_insert(&added_submodule_odb_paths, xstrdup(path));
+ string_list_insert(&added_submodule_odb_paths, path);
}
int register_all_submodule_odb_as_alternates(void)
@@ -424,6 +424,11 @@ int parse_submodule_update_strategy(const char *value,
return 0;
}
+void submodule_update_strategy_release(struct submodule_update_strategy *strategy)
+{
+ free((char *) strategy->command);
+}
+
const char *submodule_update_type_to_string(enum submodule_update_type type)
{
switch (type) {
@@ -953,6 +958,7 @@ static void free_submodules_data(struct string_list *submodules)
}
static int has_remote(const char *refname UNUSED,
+ const char *referent UNUSED,
const struct object_id *oid UNUSED,
int flags UNUSED, void *cb_data UNUSED)
{
@@ -1273,6 +1279,7 @@ int push_unpushed_submodules(struct repository *r,
}
static int append_oid_to_array(const char *ref UNUSED,
+ const char *referent UNUSED,
const struct object_id *oid,
int flags UNUSED, void *data)
{
@@ -1496,7 +1503,7 @@ static const struct submodule *get_non_gitmodules_submodule(const char *path)
return (const struct submodule *) ret;
}
-static void fetch_task_release(struct fetch_task *p)
+static void fetch_task_free(struct fetch_task *p)
{
if (p->free_sub)
free((void*)p->sub);
@@ -1508,6 +1515,7 @@ static void fetch_task_release(struct fetch_task *p)
FREE_AND_NULL(p->repo);
strvec_clear(&p->git_args);
+ free(p);
}
static struct repository *get_submodule_repo_for(struct repository *r,
@@ -1576,8 +1584,7 @@ static struct fetch_task *fetch_task_create(struct submodule_parallel_fetch *spf
return task;
cleanup:
- fetch_task_release(task);
- free(task);
+ fetch_task_free(task);
return NULL;
}
@@ -1607,8 +1614,7 @@ get_fetch_task_from_index(struct submodule_parallel_fetch *spf,
} else {
struct strbuf empty_submodule_path = STRBUF_INIT;
- fetch_task_release(task);
- free(task);
+ fetch_task_free(task);
/*
* An empty directory is normal,
@@ -1654,8 +1660,7 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,
cs_data->path,
repo_find_unique_abbrev(the_repository, cs_data->super_oid, DEFAULT_ABBREV));
- fetch_task_release(task);
- free(task);
+ fetch_task_free(task);
continue;
}
@@ -1763,7 +1768,7 @@ static int fetch_start_failure(struct strbuf *err UNUSED,
spf->result = 1;
- fetch_task_release(task);
+ fetch_task_free(task);
return 0;
}
@@ -1828,8 +1833,7 @@ static int fetch_finish(int retvalue, struct strbuf *err UNUSED,
}
out:
- fetch_task_release(task);
-
+ fetch_task_free(task);
return 0;
}
@@ -1883,6 +1887,9 @@ int fetch_submodules(struct repository *r,
strvec_clear(&spf.args);
out:
free_submodules_data(&spf.changed_submodule_names);
+ string_list_clear(&spf.seen_submodule_names, 0);
+ strbuf_release(&spf.submodules_with_errors);
+ free(spf.oid_fetch_tasks);
return spf.result;
}
@@ -2462,7 +2469,7 @@ void absorb_git_dir_into_superproject(const char *path,
} else {
/* Is it already absorbed into the superprojects git dir? */
char *real_sub_git_dir = real_pathdup(sub_git_dir, 1);
- char *real_common_git_dir = real_pathdup(get_git_common_dir(), 1);
+ char *real_common_git_dir = real_pathdup(repo_get_common_dir(the_repository), 1);
if (!starts_with(real_sub_git_dir, real_common_git_dir))
relocate_single_git_dir_into_superproject(path, super_prefix);