diff options
author | Bert Wesarg <bert.wesarg@googlemail.com> | 2020-01-27 08:04:31 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-10 19:52:10 +0100 |
commit | f2a2327a4a6a9bccade6df2bed1fdc3a8ab37f4c (patch) | |
tree | 4fe82fc9fa6fd1366d7ffa392be73e633a252a45 /t/t1308-config-set.sh | |
parent | remote rename/remove: handle branch.<name>.pushRemote config values (diff) | |
download | git-f2a2327a4a6a9bccade6df2bed1fdc3a8ab37f4c.tar.xz git-f2a2327a4a6a9bccade6df2bed1fdc3a8ab37f4c.zip |
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 't/t1308-config-set.sh')
-rwxr-xr-x | t/t1308-config-set.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh index fba0abe429..3a527e3a84 100755 --- a/t/t1308-config-set.sh +++ b/t/t1308-config-set.sh @@ -238,8 +238,8 @@ test_expect_success 'error on modifying repo config without repo' ' cmdline_config="'foo.bar=from-cmdline'" test_expect_success 'iteration shows correct origins' ' - echo "[foo]bar = from-repo" >.git/config && - echo "[foo]bar = from-home" >.gitconfig && + printf "[ignore]\n\tthis = please\n[foo]bar = from-repo\n" >.git/config && + printf "[foo]\n\tbar = from-home\n" >.gitconfig && if test_have_prereq MINGW then # Use Windows path (i.e. *not* $HOME) @@ -253,18 +253,28 @@ test_expect_success 'iteration shows correct origins' ' value=from-home origin=file name=$HOME_GITCONFIG + lno=2 scope=global + key=ignore.this + value=please + origin=file + name=.git/config + lno=2 + scope=local + key=foo.bar value=from-repo origin=file name=.git/config + lno=3 scope=local key=foo.bar value=from-cmdline origin=command line name= + lno=-1 scope=command EOF GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual && |