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

Re: [PATCH 1/2] sequencer: truncate labels to accommodate loose refs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 16, 2023, 16:28 UTC
Message-ID
<xmqqcyzneyt2.fsf@gitster.g>
In-Reply-To
<42dd6b6f-4d33-724c-ab15-ba7bb5ead733@gmx.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 8 quoted lines
> It is not a performance-critical code path, so I erred on the side of
> simplicity (although I have to admit that the post image of the diff is
> not exactly for the faint of heart).
>
> Could we maybe form the plan to keep in the back of our heads that we
> already have a UTF-8-truncating functionality in sequencer, and in case
> another user should turn up, implemnt that optimized function in
> `utf8.[ch]`?

Yup, that is a good idea. Even though this one only cares about the bytecount, we'd eventually benefit from two variants, truncate by bytecount and truncate by display width. Both variants should return an error when given a bytestring that does not make a valid UTF-8 sequence, and leave it to the caller to truncate at byte boundary as a fallback, which is trivial (the alternative would be to do the truncation by the callee, but then caller cannot tell if the returned result is a fallback result that the end user may need to be warned about or a known-valid UTF-8 substring if we go that route, so it would be suboptimal).

Thanks.
Previous: Johannes Schindelin
Message 7 of 7 in “sequencer: truncate lockfile and ref to NAME_MAX”
  1. 0/2 sequencer: truncate lockfile and ref to NAME_MAXMark Ruvald Pedersen via GitGitGadget, Aug 10, 2023
  2. 2/2 rebase: allow overriding the maximal length of the generated labelsJohannes Schindelin via GitGitGadget, Aug 10, 2023
  3. Junio C HamanoAug 10, 2023
  4. 1/2 sequencer: truncate labels to accommodate loose refsMark Ruvald Pedersen via GitGitGadget, Aug 10, 2023
  5. Junio C HamanoAug 10, 2023
  6. Johannes SchindelinAug 16, 2023
  7. Junio C HamanoAug 16, 2023

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.