Re: [PATCH v19 03/20] checkout: add '\n' to reflog message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 29, 2020 at 10:08 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>
> > From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
> >
> > Reftable precisely reproduces the given message. This leads to differences,
> > because the files backend implicitly adds a trailing '\n' to all messages.
>
> What does this mean?  With the files backend we'll now see a
> redundant two LFs in a row?  I think you are careful enough not to
> introduce unnecessary compatibility breakage like that, so perhaps
> "implicitly adds" is a wrong way to characterize what happens in the
> files backend, and it only adds LF when the message does not end
> with one, but does not add an extra one if not necessary?
>
> If so, then the change in the patch does not break compatibility,
> but the above description does not give readers confidence that it
> is indeed the case.  IOW it is unclear how this change manages to
> avoid breaking existing code.
>
> Sorry, but I am left puzzled.

Most places that write a reflog message use a message that ends with '\n'.

Some places (the one mentioned here) do not append a '\n'. When it is
read back, the message does have a '\n', leading to discrepancies with
reftable (which faithfully reproduced the message without '\n')

I initially thought we could or should fix this across git-core, but I
think it will be a lot of work to find all occurrences, so I
implemented

  https://github.com/google/reftable/commit/785f745daf567aeabe47cb01024ea879b9e15c2f

which does extra validation on reflog messages, and normalizes the
'\n' at the end. Maybe this is also worth discussing in the reftable
spec: in reftable, you can use multi-line reflog messages, but that
seems fundamentally impossible in the traditional file storage.

I can drop this commit from the series, but I think it would be a
useful cleanup anyways.

--
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux