diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-14 14:54:51 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 14:54:51 -0700 |
| commit | 4cf2f1be5639a3dc3e46ad7fbd71ad1dc16d5458 (patch) | |
| tree | a844f13dc93a4df51dcf6433e7bbcfe9bbedd755 | |
| parent | 0b2c4bc3ff6504467d84cb1bf6e73d877b553ce6 (diff) | |
| parent | 615d2de3b457272216d4179ceb82b3b2b86b1929 (diff) | |
| download | git-4cf2f1be5639a3dc3e46ad7fbd71ad1dc16d5458.tar.gz | |
Merge branch 'tb/config-fixed-value-with-valueless-true'
"git config --value=foo --fixed-value section.key newvalue" barfed
when the existing value in the configuration file used the
valueless true syntax, which has been corrected.
* tb/config-fixed-value-with-valueless-true:
config.c: avoid segfault with --fixed-value and valueless config
| -rw-r--r-- | config.c | 2 | ||||
| -rwxr-xr-x | t/t1300-config.sh | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -2914,7 +2914,7 @@ static int matches(const char *key, const char *value, { if (strcmp(key, store->key)) return 0; /* not ours */ - if (store->fixed_value) + if (store->fixed_value && value) return !strcmp(store->fixed_value, value); if (!store->value_pattern) return 1; /* always matches */ diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 9de2d95f06..f13277c8f3 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -2704,6 +2704,15 @@ test_expect_success '--get and --get-all with --fixed-value' ' test_must_fail git config --file=config --get-regexp --fixed-value fixed+ non-existent ' +test_expect_success '--fixed-value with value-less configuration' ' + test_when_finished rm -f config && + cat >config <<-\EOF && + [section] + key + EOF + git config --file=config --fixed-value section.key value pattern +' + test_expect_success 'includeIf.hasconfig:remote.*.url' ' git init hasremoteurlTest && test_when_finished "rm -rf hasremoteurlTest" && |
