From f2a2327a4a6a9bccade6df2bed1fdc3a8ab37f4c Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 27 Jan 2020 08:04:31 +0100 Subject: config: provide access to the current line number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users are nowadays trained to see message from CLI tools in the form :: … 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 Signed-off-by: Junio C Hamano --- config.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'config.c') 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; -- cgit v1.2.3