diff options
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/submodule.c b/submodule.c index 4e299f578f..bf7a2c7918 100644 --- a/submodule.c +++ b/submodule.c @@ -213,7 +213,8 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt, } /* Cheap function that only determines if we're interested in submodules at all */ -int git_default_submodule_config(const char *var, const char *value, void *cb) +int git_default_submodule_config(const char *var, const char *value, + void *cb UNUSED) { if (!strcmp(var, "submodule.recurse")) { int v = git_config_bool(var, value) ? @@ -415,10 +416,9 @@ int parse_submodule_update_strategy(const char *value, return 0; } -const char *submodule_strategy_to_string(const struct submodule_update_strategy *s) +const char *submodule_update_type_to_string(enum submodule_update_type type) { - struct strbuf sb = STRBUF_INIT; - switch (s->type) { + switch (type) { case SM_UPDATE_CHECKOUT: return "checkout"; case SM_UPDATE_MERGE: @@ -428,12 +428,11 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy case SM_UPDATE_NONE: return "none"; case SM_UPDATE_UNSPECIFIED: - return NULL; case SM_UPDATE_COMMAND: - strbuf_addf(&sb, "!%s", s->command); - return strbuf_detach(&sb, NULL); + BUG("init_submodule() should handle type %d", type); + default: + BUG("unexpected update strategy type: %d", type); } - return NULL; } void handle_ignore_submodules_arg(struct diff_options *diffopt, @@ -940,8 +939,9 @@ static void free_submodules_data(struct string_list *submodules) string_list_clear(submodules, 1); } -static int has_remote(const char *refname, const struct object_id *oid, - int flags, void *cb_data) +static int has_remote(const char *refname UNUSED, + const struct object_id *oid UNUSED, + int flags UNUSED, void *cb_data UNUSED) { return 1; } @@ -1243,8 +1243,9 @@ int push_unpushed_submodules(struct repository *r, return ret; } -static int append_oid_to_array(const char *ref, const struct object_id *oid, - int flags, void *data) +static int append_oid_to_array(const char *ref UNUSED, + const struct object_id *oid, + int flags UNUSED, void *data) { struct oid_array *array = data; oid_array_append(array, oid); @@ -2374,7 +2375,7 @@ void absorb_git_dir_into_superproject(const char *path, cp.no_stdin = 1; strvec_pushl(&cp.args, "--super-prefix", sb.buf, "submodule--helper", - "absorb-git-dirs", NULL); + "absorbgitdirs", NULL); prepare_submodule_repo_env(&cp.env); if (run_command(&cp)) die(_("could not recurse into submodule '%s'"), path); @@ -2388,7 +2389,7 @@ int get_superproject_working_tree(struct strbuf *buf) struct child_process cp = CHILD_PROCESS_INIT; struct strbuf sb = STRBUF_INIT; struct strbuf one_up = STRBUF_INIT; - const char *cwd = xgetcwd(); + char *cwd = xgetcwd(); int ret = 0; const char *subpath; int code; @@ -2451,6 +2452,7 @@ int get_superproject_working_tree(struct strbuf *buf) ret = 1; free(super_wt); } + free(cwd); strbuf_release(&sb); code = finish_command(&cp); |