Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
submodule--helper: don't overlay config in remote_submodule_branch
author
Brandon Williams
<bmwill@google.com>
Thu, 3 Aug 2017 18:19:49 +0000
(11:19 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 3 Aug 2017 20:11:01 +0000
(13:11 -0700)
Don't rely on overlaying the repository's config on top of the
submodule-config, instead query the repository's config directly for the
branch field.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
5556808
)
diff --git
a/builtin/submodule--helper.c
b/builtin/submodule--helper.c
index 1e49ce580e3bb15fe80cbcda04183b7713c8540a..f71f4270d9fc2b4b35f4a2702bb2ac8d72d4b2ae 100644
(file)
--- a/
builtin/submodule--helper.c
+++ b/
builtin/submodule--helper.c
@@
-1066,17
+1066,24
@@
static int resolve_relative_path(int argc, const char **argv, const char *prefix
static const char *remote_submodule_branch(const char *path)
{
const struct submodule *sub;
static const char *remote_submodule_branch(const char *path)
{
const struct submodule *sub;
+ const char *branch = NULL;
+ char *key;
+
gitmodules_config();
gitmodules_config();
- git_config(submodule_config, NULL);
sub = submodule_from_path(&null_oid, path);
if (!sub)
return NULL;
sub = submodule_from_path(&null_oid, path);
if (!sub)
return NULL;
- if (!sub->branch)
+ key = xstrfmt("submodule.%s.branch", sub->name);
+ if (repo_config_get_string_const(the_repository, key, &branch))
+ branch = sub->branch;
+ free(key);
+
+ if (!branch)
return "master";
return "master";
- if (!strcmp(
sub->
branch, ".")) {
+ if (!strcmp(branch, ".")) {
unsigned char sha1[20];
const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
unsigned char sha1[20];
const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
@@
-1094,7
+1101,7
@@
static const char *remote_submodule_branch(const char *path)
return refname;
}
return refname;
}
- return
sub->
branch;
+ return branch;
}
static int resolve_remote_submodule_branch(int argc, const char **argv,
}
static int resolve_remote_submodule_branch(int argc, const char **argv,