test_cmp expect actual
'
+test_expect_success 'a valueless true configuration variable is handled' '
+ test_when_finished "rm -f trace2.normal actual expect" &&
+ echo >expect &&
+ GIT_TRACE2="$(pwd)/trace2.normal" \
+ GIT_TRACE2_CONFIG_PARAMS=foo.true \
+ git -c foo.true config foo.true >actual &&
+ test_cmp expect actual
+'
+
sane_unset GIT_TRACE2_BRIEF
# Now test without environment variables and get all Trace2 settings
if (!trace2_enabled)
return;
- redacted = redact_arg(value);
+ redacted = value ? redact_arg(value) : NULL;
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_param_fl)
event_fmt_prepare(event_name, file, line, NULL, &jw);
jw_object_string(&jw, "scope", scope_name);
jw_object_string(&jw, "param", param);
- jw_object_string(&jw, "value", value);
+ if (value)
+ jw_object_string(&jw, "value", value);
jw_end(&jw);
tr2_dst_write_line(&tr2dst_event, &jw.json);
enum config_scope scope = kvi->scope;
const char *scope_name = config_scope_name(scope);
- strbuf_addf(&buf_payload, "def_param scope:%s %s=%s", scope_name, param,
- value);
+ strbuf_addf(&buf_payload, "def_param scope:%s %s", scope_name, param);
+ if (value)
+ strbuf_addf(&buf_payload, "=%s", value);
normal_io_write_fl(file, line, &buf_payload);
strbuf_release(&buf_payload);
}
struct strbuf scope_payload = STRBUF_INIT;
enum config_scope scope = kvi->scope;
const char *scope_name = config_scope_name(scope);
-
- strbuf_addf(&buf_payload, "%s:%s", param, value);
+ strbuf_addstr(&buf_payload, param);
+ if (value)
+ strbuf_addf(&buf_payload, ":%s", value);
strbuf_addf(&scope_payload, "%s:%s", "scope", scope_name);
perf_io_write_fl(file, line, event_name, NULL, NULL, NULL,