From: "Оля Тележная" <olyatelezhnaya@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH 2/4] ref-filter: add empty values to technical fields
Date: Tue, 10 Jul 2018 10:51:40 +0300 [thread overview]
Message-ID: <CAL21Bm=jHiwcau=KoX5cmnZ+8NwQi5ms=GqK52s6GWdaXddraA@mail.gmail.com> (raw)
In-Reply-To: <xmqqzhz09gqj.fsf@gitster-ct.c.googlers.com>
2018-07-10 1:39 GMT+03:00 Junio C Hamano <gitster@pobox.com>:
> Olga Telezhnaya <olyatelezhnaya@gmail.com> writes:
>
>> 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 <olyatelezhnaya@gmail.com>
>> ---
>
> Just being curious, but is there any meaningful relationship between
> what was labelled as SOURCE_NONE in the previous step and what this
> step calls "technical fields"? Things like "upstream" (which is not
> affected by the contents of the object, but is affected by the ref
> in question) and "if" (which merely exists to construct the language
> syntax) would fall into quite different category, so one might be
> subset/superset of the other, but I am wondering if we can take
> advantage of more table-driven approach taken by the previous step.
Sorry that it was not clear enough.
SOURCE_NONE fields are the fields that do not require object info.
By "technical fields" in this particular commit I mean fields that
will never be filled. So, it's a good idea to fill such fields with an
empty string and do not take them into account later (when we are
thinking whether we need to get and parse an object or not). I guess
we do not need to mark these "technical fields" in a special way: we
don't need this information. Moreover, some of the fields that I
filled with an empty string here, sometimes have non-empty
representation, and I changed nothing for such cases.
>
>
>> ref-filter.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/ref-filter.c b/ref-filter.c
>> index 8611c24fd57d1..27733ef013bed 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;
>>
>> --
>> https://github.com/git/git/pull/520
next prev parent reply other threads:[~2018-07-10 7:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 8:12 [PATCH 1/4] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-09 8:12 ` [PATCH 4/4] ref-filter: use oid_object_info() to get object Olga Telezhnaya
2018-07-09 8:12 ` [PATCH 3/4] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-10 9:19 ` SZEDER Gábor
2018-07-10 9:23 ` Johannes Schindelin
2018-07-10 10:29 ` SZEDER Gábor
2018-07-10 10:41 ` Оля Тележная
2018-07-09 8:12 ` [PATCH 2/4] ref-filter: add empty values to technical fields Olga Telezhnaya
2018-07-09 22:39 ` Junio C Hamano
2018-07-10 7:51 ` Оля Тележная [this message]
2018-07-13 12:43 ` [PATCH v2 1/4] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-13 12:43 ` [PATCH v2 2/4] ref-filter: fill empty fields with empty values Olga Telezhnaya
2018-07-13 12:43 ` [PATCH v2 3/4] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-13 12:43 ` [PATCH v2 4/4] ref-filter: use oid_object_info() to get object Olga Telezhnaya
2018-07-16 20:53 ` Junio C Hamano
2018-07-17 7:44 ` Оля Тележная
2018-07-17 22:17 ` Junio C Hamano
2018-07-17 8:22 ` [PATCH v3 1/5] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-17 8:22 ` [PATCH v3 4/5] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-17 8:22 ` [PATCH v3 2/5] ref-filter: fill empty fields with empty values Olga Telezhnaya
2018-07-17 8:22 ` [PATCH v3 5/5] ref-filter: use oid_object_info() to get object Olga Telezhnaya
2018-07-17 8:22 ` [PATCH v3 3/5] ref-filter: initialize eaten variable Olga Telezhnaya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAL21Bm=jHiwcau=KoX5cmnZ+8NwQi5ms=GqK52s6GWdaXddraA@mail.gmail.com' \
--to=olyatelezhnaya@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).