submodule: convert is_submodule_initialized to work on a repository
Convert 'is_submodule_initialized()' to take a repository object and while we're at it, lets rename the function to 'is_submodule_active()' and remove the NEEDSWORK comment. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
69aba5329e
commit
627d9342fe
@ -1,4 +1,5 @@
|
||||
#include "builtin.h"
|
||||
#include "repository.h"
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "parse-options.h"
|
||||
@ -280,7 +281,7 @@ static void module_list_active(struct module_list *list)
|
||||
for (i = 0; i < list->nr; i++) {
|
||||
const struct cache_entry *ce = list->entries[i];
|
||||
|
||||
if (!is_submodule_initialized(ce->name))
|
||||
if (!is_submodule_active(the_repository, ce->name))
|
||||
continue;
|
||||
|
||||
ALLOC_GROW(active_modules.entries,
|
||||
@ -362,7 +363,7 @@ static void init_submodule(const char *path, const char *prefix, int quiet)
|
||||
*
|
||||
* Set active flag for the submodule being initialized
|
||||
*/
|
||||
if (!is_submodule_initialized(path)) {
|
||||
if (!is_submodule_active(the_repository, path)) {
|
||||
strbuf_reset(&sb);
|
||||
strbuf_addf(&sb, "submodule.%s.active", sub->name);
|
||||
git_config_set_gently(sb.buf, "true");
|
||||
@ -817,7 +818,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
|
||||
}
|
||||
|
||||
/* Check if the submodule has been initialized. */
|
||||
if (!is_submodule_initialized(ce->name)) {
|
||||
if (!is_submodule_active(the_repository, ce->name)) {
|
||||
next_submodule_warn_missing(suc, out, displaypath);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -1193,7 +1194,7 @@ static int is_active(int argc, const char **argv, const char *prefix)
|
||||
|
||||
gitmodules_config();
|
||||
|
||||
return !is_submodule_initialized(argv[1]);
|
||||
return !is_submodule_active(the_repository, argv[1]);
|
||||
}
|
||||
|
||||
#define SUPPORT_SUPER_PREFIX (1<<0)
|
||||
|
Reference in New Issue
Block a user