1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-05 03:36:31 +02:00
git/t/helper/test-submodule-nested-repo-...
Elijah Newren 41227cb138 hash.h: move some oid-related declarations from cache.h
These defines and enum are all oid-related and as such seem to make
more sense being included in hash.h.  Further, moving them there
allows us to remove some includes of cache.h in other files.

The change to line-log.h might look unrelated, but line-log.h includes
diffcore.h, which previously included cache.h, which included the
kitchen sink.  Since this patch makes diffcore.h no longer include
cache.h, the compiler complains about the 'struct string_list *'
function parameter.  Add a forward declaration for struct string_list to
address this.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-02-23 17:25:28 -08:00

32 lines
703 B
C

#include "test-tool.h"
#include "cache.h"
#include "submodule-config.h"
static void die_usage(const char **argv, const char *msg)
{
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)
{
struct repository subrepo;
if (argc < 3)
die_usage(argv, "Wrong number of arguments.");
setup_git_directory();
if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid())) {
die_usage(argv, "Submodule not found.");
}
/* Read the config of _child_ submodules. */
print_config_from_gitmodules(&subrepo, argv[2]);
submodule_free(the_repository);
return 0;
}