git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Ben Peart <Ben.Peart@microsoft.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>,
	"sandals\@crustytoothpaste.net" <sandals@crustytoothpaste.net>,
	"stolee\@gmail.com" <stolee@gmail.com>
Subject: Re: [PATCH v1] convert log_ref_write_fd() to use strbuf
Date: Tue, 10 Jul 2018 12:41:52 -0700	[thread overview]
Message-ID: <xmqqsh4q6fpb.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180710184534.GA27535@sigill.intra.peff.net> (Jeff King's message of "Tue, 10 Jul 2018 14:45:34 -0400")

Jeff King <peff@peff.net> writes:

>> -	while (buf < cp && isspace(cp[-1]))
>> -		cp--;
>> -	*cp++ = '\n';
>> -	return cp - buf;
>> +	strbuf_rtrim(sb);
>
> Using rtrim is a nice reduction in complexity. A pure translation would
> include a final strbuf_addch(sb, '\n'). It looks like you moved that to
> the caller. There's only one, so that's OK now, but it may affect topics
> in flight (and I do in fact have an old topic that calls it).
>
> But I think it's OK, as the change in function signature means that any
> callers will need updated anyway. So there's little risk of a silent
> mis-merge.

It is interesting that we came to a slightly different conclusion,
after doing pretty much the same analysis ;-).  Unless Ben has a
plan to use a version that trims the trailing LF elsewhere, there is
no point changing what the function does, especially because the
existing and only caller does want the terminating LF at the end.

  reply	other threads:[~2018-07-10 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 18:20 [PATCH v1] convert log_ref_write_fd() to use strbuf Ben Peart
2018-07-10 18:45 ` Jeff King
2018-07-10 19:41   ` Junio C Hamano [this message]
2018-07-10 20:21     ` Jeff King
2018-07-10 20:57       ` Ben Peart
2018-07-10 21:08 ` [PATCH v2] " Ben Peart
2018-07-10 21:22   ` Junio C Hamano
2018-07-13 18:12   ` brian m. carlson

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsh4q6fpb.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Ben.Peart@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=stolee@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).