git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Thielow <ralf.thielow@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: git <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] sequencer.c: unify error messages
Date: Sun, 15 Oct 2017 19:07:11 +0200	[thread overview]
Message-ID: <CAN0XMOKjhoi-_bWqOpF-uTtaF8YrmPfR_0RMDePZSzOxAi2bwQ@mail.gmail.com> (raw)
In-Reply-To: <58336f0d-366c-6636-1e94-22afbafdfe4c@web.de>

2017-10-13 23:12 GMT+02:00 René Scharfe <l.s.r@web.de>:
> Am 13.10.2017 um 19:51 schrieb Ralf Thielow:
>> When ftruncate() in rearrange_squash() fails, we write
>> that we couldn't finish the operation on the todo file.
>> It is more accurate to write that we couldn't truncate
>> as we do in other calls of ftruncate().
>
> Would it make sense to factor out rewriting the to-do file to avoid
> code duplication in the first place?
>
>> While at there, remove a full stop in another error message.
>>
>> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
>> ---
>>   sequencer.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sequencer.c b/sequencer.c
>> index e258bb646..b0e6459a5 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -2948,9 +2948,9 @@ int rearrange_squash(void)
>>               if (fd < 0)
>>                       res = error_errno(_("could not open '%s'"), todo_file);
>>               else if (write(fd, buf.buf, buf.len) < 0)
>> -                     res = error_errno(_("could not read '%s'."), todo_file);
>> +                     res = error_errno(_("could not read '%s'"), todo_file);
>                                                        ^^^^
> That should read "write", right?
>

Sure. I'll send a new version of this patch to fix the messages. Maybe
someone else picks up the other things. Thanks.

>>               else if (ftruncate(fd, buf.len) < 0)
>> -                     res = error_errno(_("could not finish '%s'"),
>> +                     res = error_errno(_("could not truncate '%s'"),
>>                                          todo_file);
>
> Hmm, why call ftruncate(2) instead of opening the file with O_TRUNC?
>
>>               close(fd);
>>               strbuf_release(&buf);
>>

  reply	other threads:[~2017-10-15 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 17:51 [PATCH] sequencer.c: unify error messages Ralf Thielow
2017-10-13 21:12 ` René Scharfe
2017-10-15 17:07   ` Ralf Thielow [this message]
2017-10-15 15:24 ` Johannes Schindelin
2017-10-15 17:07 ` [PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash() Ralf Thielow
2017-10-16  1:52   ` Junio C Hamano
2017-10-16 11:32     ` Johannes Schindelin
2017-10-16 12:36       ` Philip Oakley
2017-10-16 12:46         ` Junio C Hamano

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=CAN0XMOKjhoi-_bWqOpF-uTtaF8YrmPfR_0RMDePZSzOxAi2bwQ@mail.gmail.com \
    --to=ralf.thielow@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=l.s.r@web.de \
    /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).