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

Re: [RFC/PATCH] sequencer: do not translate reflog messages

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2022, 17:21 UTC
Message-ID
<xmqq8rntcr8x.fsf@gitster.g>
In-Reply-To
<b8ab40b2b0e3e5d762b414329ad2f4552f935d28.1660318162.git.git@grubix.eu>
Michael J Gruber <git@grubix.eu> writes:
> Traditionally, reflog messages were never translated, in particular not
> on storage.

True, and it must (unfortunately) stay to be the way, because tools (like @{-<n>} syntax) expect to be able to parse out what we write.

Show 12 quoted lines
> Due to the switch of more parts of git to the sequencer, old changes in
> the sequencer code may lead to recent changes in git's behaviour. E.g.:
> c28cbc5ea6 ("sequencer: mark action_name() for translation", 2016-10-21)
> marked several uses of `action_name()` for translation. Recently, this
> lead to a partially translated reflog:
>
> `rebase: fast-forward` is translated (e.g. in de to `Rebase: Vorspulen`)
> whereas other reflog entries such as `rebase (pick):` remain
> untranslated as they should be.
>
> Change the relevant line in the sequencer so that this reflog entry
> remains untranslated, as well.
Good move, I would have to say X-<.

In the longer term, we need to transition to a new version of reflog message, where "git reflog" output can (meaning: with an option) or does (meaning: by default) show localized message, but the internal machinery as well as scripts can ask to see an untranslated message.

We would need to teach the reflog machinery to understand a reflog message specially formatted (e.g. with an unusual prefix like "::v2::"), from which both untranslated and translated messages can be parsed out or generated. Codepaths that write reflog messages may need to be adjusted to send both versions to the ref machinery.

Looking at recent reflog entries I happen to have in "git reflog --format="%gs" HEAD@{now}"

    checkout: moving from 219fe53025fdf5c3fb79d289a36eb2cad3f38a04 to master
    checkout: moving from master to next^0
    commit (amend): fsmonitor: option to allow fsmonitor to run against network-mounted repos
    checkout: moving from d5eaf969c17c196268d9db7af50f6767ec3a3d0a to ed/fsmonitor-on-network-disk
    am: fsmonitor: option to allow fsmonitor to run against network-mounted repos
    merge @{-1}: Merge made by the 'ort' strategy.
    checkout: moving from ll/disk-usage-humanise to seen
    am: rev-list: support human-readable output for `--disk-usage`
    checkout: moving from master to ll/disk-usage-humanise

one relatively easy way to do so may be to store the printf-like format string, possibly limiting to %s and nothing else, e.g.

    "checkout: moving from %s to %s"
    "am: %s"
    "merge %s: Merge made by the '%s' strategy"

together with the parameters to fill in these %s blanks, as a N-tuple of strings, i.e.

    ("checkout: moving from %s to %s",
     "219fe53025fdf5c3fb79d289a36eb2cad3f38a04", "master")

and then serialize them into a single long string (with that special prefix to allow us notice the format).

But I'll leave the details of how the new format can be made to allow storing raw and translated messages. The review thread of this patch is not a good place or time to discuss it.

Thanks.
Previous: Michael J GruberNext: Phillip Wood
Message 2 of 34 in “sequencer: do not translate reflog messages”
  1. sequencer: do not translate reflog messagesMichael J Gruber, Aug 12, 2022
  2. Junio C HamanoAug 12, 2022
  3. Phillip WoodAug 12, 2022
  4. Junio C HamanoAug 12, 2022
  5. Johannes SchindelinAug 15, 2022
  6. Phillip WoodAug 16, 2022
  7. Johannes SchindelinAug 16, 2022
  8. 0/4 sequencer: clarify translationsMichael J Gruber, Aug 18, 2022
  9. 3/4 sequencer: do not translate command namesMichael J Gruber, Aug 18, 2022
  10. 1/4 sequencer: do not translate reflog messagesMichael J Gruber, Aug 18, 2022
  11. Ævar Arnfjörð BjarmasonAug 18, 2022
  12. Johannes SchindelinAug 19, 2022
  13. Ævar Arnfjörð BjarmasonAug 19, 2022
  14. Junio C HamanoAug 19, 2022
  15. Ævar Arnfjörð BjarmasonAug 19, 2022
  16. Junio C HamanoAug 19, 2022
  17. Ævar Arnfjörð BjarmasonAug 19, 2022
  18. Jeff KingAug 20, 2022
  19. Junio C HamanoAug 20, 2022
  20. 2/4 sequencer: do not translate parameters to error_resolve_conflict()Michael J Gruber, Aug 18, 2022
  21. Ævar Arnfjörð BjarmasonAug 18, 2022
  22. Michael J GruberAug 18, 2022
  23. Junio C HamanoAug 18, 2022
  24. Johannes SchindelinAug 19, 2022
  25. Junio C HamanoAug 19, 2022
  26. Johannes SchindelinAug 22, 2022
  27. Junio C HamanoAug 22, 2022
  28. 4/4 po: adjust README to codeMichael J Gruber, Aug 18, 2022
  29. Ævar Arnfjörð BjarmasonAug 18, 2022
  30. Junio C HamanoAug 18, 2022
  31. 4/4 sequencer: spell out command names and do not translate themMichael J Gruber, Aug 19, 2022
  32. Johannes SchindelinAug 19, 2022
  33. Johannes SchindelinAug 19, 2022
  34. Michael J GruberAug 19, 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.