Skip to content

Commit 14ed4ad

Browse files
committed
Merge branch 'fixes-from-the-git-mailing-list'
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 <johannes.schindelin@gmx.de>
2 parents 9b7de7e + 86d0c30 commit 14ed4ad

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

grep.c

+2
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,8 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
16461646

16471647
bol = gs->buf;
16481648
left = gs->size;
1649+
if (left && gs->buf[left-1] == '\n')
1650+
left--;
16491651
while (left) {
16501652
const char *eol;
16511653
int hit;

refs/files-backend.c

-3
Original file line numberDiff line numberDiff line change
@@ -2615,9 +2615,6 @@ static int lock_ref_for_update(struct files_ref_store *refs,
26152615

26162616
update->backend_data = lock;
26172617

2618-
if (update->flags & REF_LOG_ONLY)
2619-
goto out;
2620-
26212618
if (update->type & REF_ISSYMREF) {
26222619
if (update->flags & REF_NO_DEREF) {
26232620
/*

t/t0210-trace2-normal.sh

+8
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ test_expect_success 'bug messages followed by BUG() are written to trace2' '
243243
test_cmp expect actual
244244
'
245245

246+
test_expect_success 'empty configuration values are handled' '
247+
test_when_finished "rm trace2.normal actual expect" &&
248+
echo >expect &&
249+
GIT_TRACE2="$(pwd)/trace2.normal" GIT_TRACE2_CONFIG_PARAMS=foo.empty \
250+
git -c foo.empty config foo.empty >actual &&
251+
test_cmp expect actual
252+
'
253+
246254
sane_unset GIT_TRACE2_BRIEF
247255

248256
# Now test without environment variables and get all Trace2 settings

trace2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ void trace2_def_param_fl(const char *file, int line, const char *param,
764764
if (!trace2_enabled)
765765
return;
766766

767-
redacted = redact_arg(value);
767+
redacted = value ? redact_arg(value): NULL;
768768

769769
for_each_wanted_builtin (j, tgt_j)
770770
if (tgt_j->pfn_param_fl)

trace2/tr2_tgt_event.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ static void fn_param_fl(const char *file, int line, const char *param,
493493
event_fmt_prepare(event_name, file, line, NULL, &jw);
494494
jw_object_string(&jw, "scope", scope_name);
495495
jw_object_string(&jw, "param", param);
496-
jw_object_string(&jw, "value", value);
496+
if (value)
497+
jw_object_string(&jw, "value", value);
497498
jw_end(&jw);
498499

499500
tr2_dst_write_line(&tr2dst_event, &jw.json);

trace2/tr2_tgt_normal.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ static void fn_param_fl(const char *file, int line, const char *param,
307307
enum config_scope scope = kvi->scope;
308308
const char *scope_name = config_scope_name(scope);
309309

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);
312313
normal_io_write_fl(file, line, &buf_payload);
313314
strbuf_release(&buf_payload);
314315
}

trace2/tr2_tgt_perf.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,9 @@ static void fn_param_fl(const char *file, int line, const char *param,
448448
struct strbuf scope_payload = STRBUF_INIT;
449449
enum config_scope scope = kvi->scope;
450450
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);
453454
strbuf_addf(&scope_payload, "%s:%s", "scope", scope_name);
454455

455456
perf_io_write_fl(file, line, event_name, NULL, NULL, NULL,

0 commit comments

Comments
 (0)