From: Jonathan Tan Date: Thu, 01 Jun 2023 23:54:01 GMT Subject: Re: [PATCH v2 07/14] config: provide kvi with config files Message-ID: <20230601235401.432962-1-jonathantanmy@google.com> In-Reply-To: <641a56f0b40a88b0127819989ed1f81f844a090e.1685472133.git.gitgitgadget@gmail.com> "Glen Choo via GitGitGadget" writes: > @@ -963,7 +965,8 @@ static int get_value(struct config_source *cs, config_fn_t fn, void *data, > * accurate line number in error messages. > */ > cs->linenr--; > - ret = fn(name->buf, value, NULL, data); > + kvi->linenr = cs->linenr; > + ret = fn(name->buf, value, kvi, data); Forgot to mention in my other email...it's a pity that we have to bump the kvi->linenr like this because the original kvi generated from the cs is now out-to-date w.r.t. the cs in terms of line number (you can see in the context how the cs linenr is also updated), so there are now 2 sources of truth with regards to the line number. I can't think of a better way to do this, though.