mirror of
https://github.com/git/git.git
synced 2024-12-11 19:03:50 +08:00
d1cbe1e6d8
hash.h depends upon and includes repository.h, due to the definition and use of the_hash_algo (defined as the_repository->hash_algo). However, most headers trying to include hash.h are only interested in the layout of the structs like object_id. Move the parts of hash.h that do not depend upon repository.h into a new file hash-ll.h (the "low level" parts of hash.h), and adjust other files to use this new header where the convenience inline functions aren't needed. This allows hash.h and object.h to be fairly small, minimal headers. It also exposes a lot of hidden dependencies on both path.h (which was brought in by repository.h) and repository.h (which was previously implicitly brought in by object.h), so also adjust other files to be more explicit about what they depend upon. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
33 lines
727 B
C
33 lines
727 B
C
#include "test-tool.h"
|
|
#include "repository.h"
|
|
#include "setup.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;
|
|
}
|