Skip to content

Commit 7085839

Browse files
telezhnayagitster
authored andcommitted
ref-filter: add empty values to technical fields
Atoms like "align" or "end" do not have string representation. Earlier we had to go and parse whole object with a hope that we could fill their string representations. It's easier to fill them with an empty string before we start to work with whole object. Signed-off-by: Olga Telezhnaia <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 95022cb commit 7085839

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ref-filter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
14971497
refname = get_symref(atom, ref);
14981498
else if (starts_with(name, "upstream")) {
14991499
const char *branch_name;
1500+
v->s = "";
15001501
/* only local branches may have an upstream */
15011502
if (!skip_prefix(ref->refname, "refs/heads/",
15021503
&branch_name))
@@ -1509,6 +1510,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
15091510
continue;
15101511
} else if (atom->u.remote_ref.push) {
15111512
const char *branch_name;
1513+
v->s = "";
15121514
if (!skip_prefix(ref->refname, "refs/heads/",
15131515
&branch_name))
15141516
continue;
@@ -1549,22 +1551,26 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
15491551
continue;
15501552
} else if (starts_with(name, "align")) {
15511553
v->handler = align_atom_handler;
1554+
v->s = "";
15521555
continue;
15531556
} else if (!strcmp(name, "end")) {
15541557
v->handler = end_atom_handler;
1558+
v->s = "";
15551559
continue;
15561560
} else if (starts_with(name, "if")) {
15571561
const char *s;
1558-
1562+
v->s = "";
15591563
if (skip_prefix(name, "if:", &s))
15601564
v->s = xstrdup(s);
15611565
v->handler = if_atom_handler;
15621566
continue;
15631567
} else if (!strcmp(name, "then")) {
15641568
v->handler = then_atom_handler;
1569+
v->s = "";
15651570
continue;
15661571
} else if (!strcmp(name, "else")) {
15671572
v->handler = else_atom_handler;
1573+
v->s = "";
15681574
continue;
15691575
} else
15701576
continue;

0 commit comments

Comments
 (0)