Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlga Telezhnaya <olyatelezhnaya@gmail.com>2018-07-17 11:22:57 +0300
committerJunio C Hamano <gitster@pobox.com>2018-07-18 01:04:27 +0300
commit20a9c156198bf195b7d32ef9a73ba01b8b19f52c (patch)
tree5d6ff684469bd0220ecb204096515ad7a4157d05 /ref-filter.c
parenta8e7e385cd239e9e862aba2038c43d4af07c187d (diff)
ref-filter: fill empty fields with empty values
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. It is important to mention that we fill only these atoms that must contain nothing. So, if we could not fill the atom because, for example, the object is missing, we leave it with NULL. Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 8611c24fd5..27733ef013 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1497,6 +1497,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
refname = get_symref(atom, ref);
else if (starts_with(name, "upstream")) {
const char *branch_name;
+ v->s = "";
/* only local branches may have an upstream */
if (!skip_prefix(ref->refname, "refs/heads/",
&branch_name))
@@ -1509,6 +1510,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
continue;
} else if (atom->u.remote_ref.push) {
const char *branch_name;
+ v->s = "";
if (!skip_prefix(ref->refname, "refs/heads/",
&branch_name))
continue;
@@ -1549,22 +1551,26 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
continue;
} else if (starts_with(name, "align")) {
v->handler = align_atom_handler;
+ v->s = "";
continue;
} else if (!strcmp(name, "end")) {
v->handler = end_atom_handler;
+ v->s = "";
continue;
} else if (starts_with(name, "if")) {
const char *s;
-
+ v->s = "";
if (skip_prefix(name, "if:", &s))
v->s = xstrdup(s);
v->handler = if_atom_handler;
continue;
} else if (!strcmp(name, "then")) {
v->handler = then_atom_handler;
+ v->s = "";
continue;
} else if (!strcmp(name, "else")) {
v->handler = else_atom_handler;
+ v->s = "";
continue;
} else
continue;