From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org, johan@herland.net, josh@joshtriplett.org,
tr@thomasrast.ch, mhagger@alum.mit.edu, dan.carpenter@oracle.com,
greg@kroah.com, peff@peff.net, sunshine@sunshineco.com,
ramsay@ramsay1.demon.co.uk, jrnieder@gmail.com,
marcnarc@xiplink.com
Subject: Re: [PATCH 4/5] trailer: reuse ignore_non_trailer() to ignore conflict lines
Date: Sun, 09 Nov 2014 14:40:09 -0800 [thread overview]
Message-ID: <xmqq8ujkath2.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqlhnkb5bf.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Sun, 09 Nov 2014 10:24:20 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Christian Couder <chriscool@tuxfamily.org> writes:
>>
>>> Yeah, it won't be as efficient as using only one strbuf and only byte
>>> oriented functions, and it looks much less manly too :-) But over time in
>>> Git we have developed a number of less efficient but quite clean
>>> abstractions like strbuf, argv_array, sha1_array and so on, that we
>>> are quite happy with.
>>
>> Actually, all these examples you gave are fairly efficient and clean
>> abstractions. I find it insulting to pretend that the "one line per
>> strbuf" is in the same league. It isn't.
>>
>> And it is not about manliness.
>
> By the way, I do not mean to say that all of strbuf (which is a
> rather full API) is uniformly efficient and cleanly abstracted.
> ...
Having said all that, please notice that I said "might need to be
rethought before the code becomes ready for production."
After all, it would have perfectly been OK to experiment with this
new topic in a script; e.g. this topic being text processing, it
might have happened as a Perl script while we get the semantics and
desirable features nailed down before rewriting the real thing in C.
And if that were what happened here, I wouldn't have been talking
about data structures and unnecessary complexity having to have one
strbuf per line only to join them into one string (or printf() out
to a stream one-after-another) later.
In other words, I did not say "this code is too ugly to live and we
should clean it up as soon as possible or we should revert it from
'master'---it was a mistake to merge it".
I consider the "trailer" code in 'master' today as experimental (in
other words, something I might have written in a scripting language
as a mock-up if I were doing it) that needs to be worked on further
to still get the features and semantics right. And the patch series
in this thread are hopefully taking us in the right direction to get
them right [*1*].
You could have just said "Yeah, I realize that the code is way
suboptimal, but lets get it feature complete first and then clean it
up", or something, instead of getting defensive with unnecessary
excuses.
[Footnote]
*1* ... even though this step exposes why the approach taken,
splitting the input lines first into individual lines without even
looking at them, is a wrong one---if you started from a single
buffer that is not yet split, it would have been much easier to find
where the trailer block is, and that is why you are re-joining the
buffer you have already split into lines (i.e. what I called
"impedance mismatch"), which shows that the initial splitting is
done prematurely. Hopefully you would realize that by now ;-).
next prev parent reply other threads:[~2014-11-09 22:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 18:50 [PATCH 0/5] Small "git interpret-trailers" fixes Christian Couder
2014-11-07 18:50 ` [PATCH 1/5] trailer: ignore comment lines inside the trailers Christian Couder
2014-11-07 18:50 ` [PATCH 2/5] trailer: display a trailer without its trailing newline Christian Couder
2014-11-07 19:22 ` Jeff King
2014-11-07 19:26 ` Junio C Hamano
2014-11-07 18:50 ` [PATCH 3/5] commit: make ignore_non_trailer() non static Christian Couder
2014-11-07 18:50 ` [PATCH 4/5] trailer: reuse ignore_non_trailer() to ignore conflict lines Christian Couder
2014-11-07 20:27 ` Junio C Hamano
2014-11-09 10:35 ` Christian Couder
2014-11-09 16:45 ` Junio C Hamano
2014-11-09 18:24 ` Junio C Hamano
2014-11-09 22:40 ` Junio C Hamano [this message]
2014-11-07 18:50 ` [PATCH 5/5] trailer: add test with an old style conflict block Christian Couder
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=xmqq8ujkath2.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=chriscool@tuxfamily.org \
--cc=dan.carpenter@oracle.com \
--cc=git@vger.kernel.org \
--cc=greg@kroah.com \
--cc=johan@herland.net \
--cc=josh@joshtriplett.org \
--cc=jrnieder@gmail.com \
--cc=marcnarc@xiplink.com \
--cc=mhagger@alum.mit.edu \
--cc=peff@peff.net \
--cc=ramsay@ramsay1.demon.co.uk \
--cc=sunshine@sunshineco.com \
--cc=tr@thomasrast.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.