diff options
author | brian m. carlson <bk2204@github.com> | 2020-02-20 02:24:12 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-20 13:05:43 -0800 |
commit | 82eb249853868582d8ba65e3afc5a7dcaeb620ea (patch) | |
tree | f7810f74a0f26aa183be36239edadbad5cf7b3ab /t | |
parent | t0300: add tests for some additional cases (diff) | |
download | tgif-82eb249853868582d8ba65e3afc5a7dcaeb620ea.tar.xz |
credential: use the last matching username in the config
Everywhere else in the codebase, we use the rule that the last matching
configuration option is the one that takes effect. This is helpful
because it allows more specific configuration settings (e.g., per-repo
configuration) to override less specific settings (e.g., per-user
configuration).
However, in the credential code, we didn't honor this setting, and
instead picked the first setting we had, and stuck with it. This was
likely to ensure we picked the value from the URL, which we want to
honor over the configuration.
It's possible to do both, though, so let's check if the value is the one
we've gotten over our protocol connection, which if present will have
come from the URL, and keep it if so. Otherwise, let's overwrite the
value with the latest version we've got from the configuration, so we
keep the last configuration value.
Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0300-credentials.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh index 4593a0cd3d..8f87599056 100755 --- a/t/t0300-credentials.sh +++ b/t/t0300-credentials.sh @@ -344,7 +344,7 @@ test_expect_success 'honors username from URL over helper (components)' ' EOF ' -test_expect_failure 'last matching username wins' ' +test_expect_success 'last matching username wins' ' test_config credential.https://example.com/path.git.username bob && test_config credential.https://example.com.username alice && test_config credential.https://example.com.helper "verbatim \"\" bar" && |