Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'submodule-config.c')
-rw-r--r--submodule-config.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/submodule-config.c b/submodule-config.c
index 8c00855ed8..bb52c8d6b2 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -281,7 +281,10 @@ static int parse_fetch_recurse(const char *opt, const char *arg,
default:
if (!strcmp(arg, "on-demand"))
return RECURSE_SUBMODULES_ON_DEMAND;
-
+ /*
+ * Please update $__git_fetch_recurse_submodules in
+ * git-completion.bash when you add new options.
+ */
if (die_on_error)
die("bad %s argument: %s", opt, arg);
else
@@ -362,6 +365,10 @@ static int parse_push_recurse(const char *opt, const char *arg,
return RECURSE_SUBMODULES_CHECK;
else if (!strcmp(arg, "only"))
return RECURSE_SUBMODULES_ONLY;
+ /*
+ * Please update $__git_push_recurse_submodules in
+ * git-completion.bash when you add new modes.
+ */
else if (die_on_error)
die("bad %s argument: %s", opt, arg);
else
@@ -626,23 +633,16 @@ static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void
const struct config_options opts = { 0 };
struct object_id oid;
char *file;
+ char *oidstr = NULL;
file = repo_worktree_path(repo, GITMODULES_FILE);
if (file_exists(file)) {
config_source.file = file;
- } else if (repo->submodule_prefix) {
- /*
- * When get_oid and config_with_options, used below,
- * become able to work on a specific repository, this
- * warning branch can be removed.
- */
- warning("nested submodules without %s in the working tree are not supported yet",
- GITMODULES_FILE);
- goto out;
- } else if (get_oid(GITMODULES_INDEX, &oid) >= 0) {
- config_source.blob = GITMODULES_INDEX;
- } else if (get_oid(GITMODULES_HEAD, &oid) >= 0) {
- config_source.blob = GITMODULES_HEAD;
+ } else if (repo_get_oid(repo, GITMODULES_INDEX, &oid) >= 0 ||
+ repo_get_oid(repo, GITMODULES_HEAD, &oid) >= 0) {
+ config_source.blob = oidstr = xstrdup(oid_to_hex(&oid));
+ if (repo != the_repository)
+ add_to_alternates_memory(repo->objects->odb->path);
} else {
goto out;
}
@@ -650,6 +650,7 @@ static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void
config_with_options(fn, data, &config_source, &opts);
out:
+ free(oidstr);
free(file);
}
}