Git fork

Merge branch 'am/trace2-with-valueless-true'

The trace2 code was not prepared to show a configuration variable
that is set to true using the valueless true syntax, which has been
corrected.

* am/trace2-with-valueless-true:
trace2: prevent segfault on config collection with valueless true

+18 -6
+9
t/t0210-trace2-normal.sh
··· 243 243 test_cmp expect actual 244 244 ' 245 245 246 + test_expect_success 'a valueless true configuration variable is handled' ' 247 + test_when_finished "rm -f trace2.normal actual expect" && 248 + echo >expect && 249 + GIT_TRACE2="$(pwd)/trace2.normal" \ 250 + GIT_TRACE2_CONFIG_PARAMS=foo.true \ 251 + git -c foo.true config foo.true >actual && 252 + test_cmp expect actual 253 + ' 254 + 246 255 sane_unset GIT_TRACE2_BRIEF 247 256 248 257 # Now test without environment variables and get all Trace2 settings
+1 -1
trace2.c
··· 764 764 if (!trace2_enabled) 765 765 return; 766 766 767 - redacted = redact_arg(value); 767 + redacted = value ? redact_arg(value) : NULL; 768 768 769 769 for_each_wanted_builtin (j, tgt_j) 770 770 if (tgt_j->pfn_param_fl)
+2 -1
trace2/tr2_tgt_event.c
··· 493 493 event_fmt_prepare(event_name, file, line, NULL, &jw); 494 494 jw_object_string(&jw, "scope", scope_name); 495 495 jw_object_string(&jw, "param", param); 496 - jw_object_string(&jw, "value", value); 496 + if (value) 497 + jw_object_string(&jw, "value", value); 497 498 jw_end(&jw); 498 499 499 500 tr2_dst_write_line(&tr2dst_event, &jw.json);
+3 -2
trace2/tr2_tgt_normal.c
··· 307 307 enum config_scope scope = kvi->scope; 308 308 const char *scope_name = config_scope_name(scope); 309 309 310 - strbuf_addf(&buf_payload, "def_param scope:%s %s=%s", scope_name, param, 311 - value); 310 + strbuf_addf(&buf_payload, "def_param scope:%s %s", scope_name, param); 311 + if (value) 312 + strbuf_addf(&buf_payload, "=%s", value); 312 313 normal_io_write_fl(file, line, &buf_payload); 313 314 strbuf_release(&buf_payload); 314 315 }
+3 -2
trace2/tr2_tgt_perf.c
··· 448 448 struct strbuf scope_payload = STRBUF_INIT; 449 449 enum config_scope scope = kvi->scope; 450 450 const char *scope_name = config_scope_name(scope); 451 - 452 - strbuf_addf(&buf_payload, "%s:%s", param, value); 451 + strbuf_addstr(&buf_payload, param); 452 + if (value) 453 + strbuf_addf(&buf_payload, ":%s", value); 453 454 strbuf_addf(&scope_payload, "%s:%s", "scope", scope_name); 454 455 455 456 perf_io_write_fl(file, line, event_name, NULL, NULL, NULL,