Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2020-01-27 10:04:31 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-10 21:52:10 +0300
commitf2a2327a4a6a9bccade6df2bed1fdc3a8ab37f4c (patch)
tree4fe82fc9fa6fd1366d7ffa392be73e633a252a45 /config.c
parent923d4a5ca4f86c19247ef436e6d03d261ebce904 (diff)
config: provide access to the current line number
Users are nowadays trained to see message from CLI tools in the form <file>:<lno>: … To be able to give such messages when notifying the user about configurations in any config file, it is currently only possible to get the file name (if the value originates from a file to begin with) via `current_config_name()`. Now it is also possible to query the current line number for the configuration. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.c b/config.c
index 18a6bdd9ff..222e49a7c8 100644
--- a/config.c
+++ b/config.c
@@ -3338,6 +3338,14 @@ enum config_scope current_config_scope(void)
return current_parsing_scope;
}
+int current_config_line(void)
+{
+ if (current_config_kvi)
+ return current_config_kvi->linenr;
+ else
+ return cf->linenr;
+}
+
int lookup_config(const char **mapping, int nr_mapping, const char *var)
{
int i;