Skip to content

Commit

Permalink
Merge branch 'fixes-from-the-git-mailing-list'
Browse files Browse the repository at this point in the history
These fixes have been sent to the Git mailing list but have not been
picked up by the Git project yet.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Jan 22, 2025
2 parents 9b7de7e + 86d0c30 commit 14ed4ad
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,8 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle

bol = gs->buf;
left = gs->size;
if (left && gs->buf[left-1] == '\n')
left--;
while (left) {
const char *eol;
int hit;
Expand Down
3 changes: 0 additions & 3 deletions refs/files-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2615,9 +2615,6 @@ static int lock_ref_for_update(struct files_ref_store *refs,

update->backend_data = lock;

if (update->flags & REF_LOG_ONLY)
goto out;

if (update->type & REF_ISSYMREF) {
if (update->flags & REF_NO_DEREF) {
/*
Expand Down
8 changes: 8 additions & 0 deletions t/t0210-trace2-normal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ test_expect_success 'bug messages followed by BUG() are written to trace2' '
test_cmp expect actual
'

test_expect_success 'empty configuration values are handled' '
test_when_finished "rm trace2.normal actual expect" &&
echo >expect &&
GIT_TRACE2="$(pwd)/trace2.normal" GIT_TRACE2_CONFIG_PARAMS=foo.empty \
git -c foo.empty config foo.empty >actual &&
test_cmp expect actual
'

sane_unset GIT_TRACE2_BRIEF

# Now test without environment variables and get all Trace2 settings
Expand Down
2 changes: 1 addition & 1 deletion trace2.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ void trace2_def_param_fl(const char *file, int line, const char *param,
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)
Expand Down
3 changes: 2 additions & 1 deletion trace2/tr2_tgt_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ static void fn_param_fl(const char *file, int line, const char *param,
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);
Expand Down
5 changes: 3 additions & 2 deletions trace2/tr2_tgt_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ static void fn_param_fl(const char *file, int line, const char *param,
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);
}
Expand Down
5 changes: 3 additions & 2 deletions trace2/tr2_tgt_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ static void fn_param_fl(const char *file, int line, const char *param,
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,
Expand Down

0 comments on commit 14ed4ad

Please sign in to comment.