| 1 | #define USE_THE_REPOSITORY_VARIABLE |
| 2 | |
| 3 | #include "test-tool.h" |
| 4 | #include "repository.h" |
| 5 | #include "setup.h" |
| 6 | #include "submodule-config.h" |
| 7 | |
| 8 | static void die_usage(const char **argv, const char *msg) |
| 9 | { |
| 10 | fprintf(stderr, "%s\n", msg); |
| 11 | fprintf(stderr, "Usage: %s <submodulepath> <config name>\n", argv[0]); |
| 12 | exit(1); |
| 13 | } |
| 14 | |
| 15 | int cmd__submodule_nested_repo_config(int argc, const char **argv) |
| 16 | { |
| 17 | struct repository subrepo; |
| 18 | |
| 19 | if (argc < 3) |
| 20 | die_usage(argv, "Wrong number of arguments."); |
| 21 | |
| 22 | setup_git_directory(the_repository); |
| 23 | |
| 24 | if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid(the_hash_algo))) { |
| 25 | die_usage(argv, "Submodule not found."); |
| 26 | } |
| 27 | |
| 28 | /* Read the config of _child_ submodules. */ |
| 29 | print_config_from_gitmodules(&subrepo, argv[2]); |
| 30 | |
| 31 | submodule_free(the_repository); |
| 32 | repo_clear(&subrepo); |
| 33 | return 0; |
| 34 | } |