git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] [RFC] git-p4: improve encoding handling to support inconsistent encodings

From
Tao Klerks <tao@klerks.biz>
Date
Apr 19, 2022, 20:30 UTC
Message-ID
<CAPMMpojwo0BG45BNN6urAgd-yt1BPXKPmH6q8zza+v9BDaXKng@mail.gmail.com>
In-Reply-To
<80e83d8e-1f68-16be-6d68-fbc4aadfc78d@adoakley.name>
On Sun, Apr 17, 2022 at 8:17 PM Andrew Oakley <andrew@adoakley.name> wrote:
Show 7 quoted lines
>
>
> The way I look at it is that you both read and write bytes, and you may
> attempt to decode and re-encode text on the way.  Both the decoding and
> the encoding are done in metadata_stream_to_writable_bytes, so nothing
> else needs to know about the raw option being different.
>

Right - personally I just believe making the distinction explicit as "strategies" makes for a less magical explanation than a special encoding value that's not just a different encoding but also a different behavior.

In other aspects, the behavior you're proposing (except for the final fallback-decoding-failure) seems to be equivalent to what I've implemented in the latest version.

Show 21 quoted lines
>
> > I understand and share the data loss concern.
> >
> > As I just answered Ævar, I *think* I'd like to address the data loss
> > concern by escaping all x80+ bytes if something cannot be interpreted
> > even using the fallback encoding. In a commit message there could also
> > be a suffix explaining what happened, although I suspect that's
> > pointless complexity. The advantage of this approach is that it makes
> > it *possible* to reconstruct the original bytestream precisely, but
> > without creating badly-encoded git commit messages that need to be
> > skirted around.
>
> I think this gets pretty messy though.  In my opinion it's not any nicer
> than putting the raw bytes in the commit message.
>
> Git does not make any attempt enforce the commit metadata encoding, so I
> think that tools really should make an attempt to handle invalid data in
> a somewhat sensible fashion.
>
> I don't think there is really a "right" answer, anything reasonable
> would be better than what we've got now.

Alright - I went ahead with the "escape if you can't do it right" behavior anyway, because it makes me feel better about being able to say "no information loss" :)

Previous: Andrew OakleyNext: Tao Klerks via GitGitGadget
Message 10 of 13 in “[RFC] git-p4: improve encoding handling to support inconsistent encodings”
  1. [RFC] git-p4: improve encoding handling to support inconsistent encodingsTao Klerks via GitGitGadget, Apr 11, 2022
  2. [RFC] git-p4: improve encoding handling to support inconsistent encodingsTao Klerks via GitGitGadget, Apr 13, 2022
  3. Ævar Arnfjörð BjarmasonApr 13, 2022
  4. Tao KlerksApr 13, 2022
  5. Ævar Arnfjörð BjarmasonApr 13, 2022
  6. Tao KlerksApr 14, 2022
  7. Andrew OakleyApr 13, 2022
  8. Tao KlerksApr 14, 2022
  9. Andrew OakleyApr 17, 2022
  10. Tao KlerksApr 19, 2022
  11. git-p4: improve encoding handling to support inconsistent encodingsTao Klerks via GitGitGadget, Apr 19, 2022
  12. Tao KlerksApr 19, 2022
  13. git-p4: improve encoding handling to support inconsistent encodingsTao Klerks via GitGitGadget, Apr 30, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.