]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-submodule-nested-repo-config.c
Merge branch 'bb/unicode-width-table-15'
[thirdparty/git.git] / t / helper / test-submodule-nested-repo-config.c
CommitLineData
2b1257e4 1#include "test-tool.h"
d1cbe1e6 2#include "repository.h"
e38da487 3#include "setup.h"
2b1257e4
AO
4#include "submodule-config.h"
5
e885a84f 6static void die_usage(const char **argv, const char *msg)
2b1257e4
AO
7{
8 fprintf(stderr, "%s\n", msg);
9 fprintf(stderr, "Usage: %s <submodulepath> <config name>\n", argv[0]);
10 exit(1);
11}
12
13int cmd__submodule_nested_repo_config(int argc, const char **argv)
14{
d5498e08 15 struct repository subrepo;
2b1257e4
AO
16
17 if (argc < 3)
e885a84f 18 die_usage(argv, "Wrong number of arguments.");
2b1257e4
AO
19
20 setup_git_directory();
21
8eb8dcf9 22 if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid())) {
e885a84f 23 die_usage(argv, "Submodule not found.");
2b1257e4
AO
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}