]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-submodule-nested-repo-config.c
Merge branch 'tt/bisect-in-c'
[thirdparty/git.git] / t / helper / test-submodule-nested-repo-config.c
CommitLineData
2b1257e4
AO
1#include "test-tool.h"
2#include "submodule-config.h"
3
4static void die_usage(int argc, const char **argv, const char *msg)
5{
6 fprintf(stderr, "%s\n", msg);
7 fprintf(stderr, "Usage: %s <submodulepath> <config name>\n", argv[0]);
8 exit(1);
9}
10
11int cmd__submodule_nested_repo_config(int argc, const char **argv)
12{
d5498e08
SB
13 struct repository subrepo;
14 const struct submodule *sub;
2b1257e4
AO
15
16 if (argc < 3)
17 die_usage(argc, argv, "Wrong number of arguments.");
18
19 setup_git_directory();
20
d5498e08
SB
21 sub = submodule_from_path(the_repository, &null_oid, argv[1]);
22 if (repo_submodule_init(&subrepo, the_repository, sub)) {
2b1257e4
AO
23 die_usage(argc, argv, "Submodule not found.");
24 }
25
26 /* Read the config of _child_ submodules. */
d5498e08 27 print_config_from_gitmodules(&subrepo, argv[2]);
2b1257e4
AO
28
29 submodule_free(the_repository);
30
31 return 0;
32}