2018-10-25 16:18:13 +00:00
|
|
|
#include "test-tool.h"
|
2023-04-22 20:17:20 +00:00
|
|
|
#include "repository.h"
|
2023-03-21 06:26:05 +00:00
|
|
|
#include "setup.h"
|
2018-10-25 16:18:13 +00:00
|
|
|
#include "submodule-config.h"
|
|
|
|
|
2020-09-30 12:28:18 +00:00
|
|
|
static void die_usage(const char **argv, const char *msg)
|
2018-10-25 16:18:13 +00: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 00:27:53 +00:00
|
|
|
struct repository subrepo;
|
2018-10-25 16:18:13 +00:00
|
|
|
|
|
|
|
if (argc < 3)
|
2020-09-30 12:28:18 +00:00
|
|
|
die_usage(argv, "Wrong number of arguments.");
|
2018-10-25 16:18:13 +00:00
|
|
|
|
|
|
|
setup_git_directory();
|
|
|
|
|
2021-09-09 18:47:28 +00:00
|
|
|
if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid())) {
|
2020-09-30 12:28:18 +00:00
|
|
|
die_usage(argv, "Submodule not found.");
|
2018-10-25 16:18:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the config of _child_ submodules. */
|
2018-11-29 00:27:53 +00:00
|
|
|
print_config_from_gitmodules(&subrepo, argv[2]);
|
2018-10-25 16:18:13 +00:00
|
|
|
|
|
|
|
submodule_free(the_repository);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|