2018-10-25 18:18:13 +02:00
|
|
|
#include "test-tool.h"
|
|
|
|
#include "submodule-config.h"
|
|
|
|
|
2020-09-30 14:28:18 +02:00
|
|
|
static void die_usage(const char **argv, const char *msg)
|
2018-10-25 18:18:13 +02:00
|
|
|
{
|
|
|
|
fprintf(stderr, "%s\n", msg);
|
|
|
|
fprintf(stderr, "Usage: %s <submodulepath> <config name>\n", argv[0]);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cmd__submodule_nested_repo_config(int argc, const char **argv)
|
|
|
|
{
|
2018-11-29 01:27:53 +01:00
|
|
|
struct repository subrepo;
|
|
|
|
const struct submodule *sub;
|
2018-10-25 18:18:13 +02:00
|
|
|
|
|
|
|
if (argc < 3)
|
2020-09-30 14:28:18 +02:00
|
|
|
die_usage(argv, "Wrong number of arguments.");
|
2018-10-25 18:18:13 +02:00
|
|
|
|
|
|
|
setup_git_directory();
|
|
|
|
|
2018-11-29 01:27:53 +01:00
|
|
|
sub = submodule_from_path(the_repository, &null_oid, argv[1]);
|
|
|
|
if (repo_submodule_init(&subrepo, the_repository, sub)) {
|
2020-09-30 14:28:18 +02:00
|
|
|
die_usage(argv, "Submodule not found.");
|
2018-10-25 18:18:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the config of _child_ submodules. */
|
2018-11-29 01:27:53 +01:00
|
|
|
print_config_from_gitmodules(&subrepo, argv[2]);
|
2018-10-25 18:18:13 +02:00
|
|
|
|
|
|
|
submodule_free(the_repository);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|