submodule: add a print_config_from_gitmodules() helper

Add a new print_config_from_gitmodules() helper function to print values
from .gitmodules just like "git config -f .gitmodules" would.

This will be used by a new submodule--helper subcommand to be able to
access the .gitmodules file in a more controlled way.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Antonio Ospite
2018-10-05 15:05:52 +02:00
committed by Junio C Hamano
parent 1d4361b0f3
commit bcbc780d14
2 changed files with 26 additions and 0 deletions

View File

@ -48,6 +48,7 @@ const struct submodule *submodule_from_path(struct repository *r,
const struct object_id *commit_or_tree,
const char *path);
void submodule_free(struct repository *r);
int print_config_from_gitmodules(struct repository *repo, const char *key);
/*
* Returns 0 if the name is syntactically acceptable as a submodule "name"