git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael J Gruber <git@grubix.eu>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [RFC/PATCH] sequencer: do not translate reflog messages
Date: Fri, 12 Aug 2022 10:21:18 -0700	[thread overview]
Message-ID: <xmqq8rntcr8x.fsf@gitster.g> (raw)
In-Reply-To: <b8ab40b2b0e3e5d762b414329ad2f4552f935d28.1660318162.git.git@grubix.eu> (Michael J. Gruber's message of "Fri, 12 Aug 2022 17:38:40 +0200")

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.

> 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.

  reply	other threads:[~2022-08-12 17:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 15:38 [RFC/PATCH] sequencer: do not translate reflog messages Michael J Gruber
2022-08-12 17:21 ` Junio C Hamano [this message]
2022-08-12 19:21 ` Phillip Wood
2022-08-12 20:43   ` Junio C Hamano
2022-08-15 20:20     ` Johannes Schindelin
2022-08-16  8:59       ` Phillip Wood
2022-08-16 11:02         ` Johannes Schindelin
2022-08-18 13:13           ` [PATCH 0/4] sequencer: clarify translations Michael J Gruber
2022-08-18 13:13             ` [PATCH 1/4] sequencer: do not translate reflog messages Michael J Gruber
2022-08-18 14:55               ` Ævar Arnfjörð Bjarmason
2022-08-19  9:25                 ` Johannes Schindelin
2022-08-19 15:12                   ` Ævar Arnfjörð Bjarmason
2022-08-19 20:44                     ` Junio C Hamano
2022-08-19 21:13                       ` Ævar Arnfjörð Bjarmason
2022-08-19 22:42                         ` Junio C Hamano
2022-08-19 23:33                           ` Ævar Arnfjörð Bjarmason
2022-08-20  8:56                         ` Jeff King
2022-08-20 21:20                           ` Junio C Hamano
2022-08-18 13:13             ` [PATCH 2/4] sequencer: do not translate parameters to error_resolve_conflict() Michael J Gruber
2022-08-18 15:01               ` Ævar Arnfjörð Bjarmason
2022-08-18 15:23                 ` Michael J Gruber
2022-08-18 20:30                   ` Junio C Hamano
2022-08-19  9:26                 ` Johannes Schindelin
2022-08-19 17:36                   ` Junio C Hamano
2022-08-22 13:53                     ` Johannes Schindelin
2022-08-22 16:12                       ` Junio C Hamano
2022-08-18 13:13             ` [PATCH 3/4] sequencer: do not translate command names Michael J Gruber
2022-08-18 13:13             ` [PATCH 4/4] po: adjust README to code Michael J Gruber
2022-08-18 15:03               ` Ævar Arnfjörð Bjarmason
2022-08-18 20:36               ` Junio C Hamano
2022-08-19  7:50                 ` [PATCH 4/4 v2] sequencer: spell out command names and do not translate them Michael J Gruber
2022-08-19  9:30                   ` Johannes Schindelin
2022-08-19  9:32             ` [PATCH 0/4] sequencer: clarify translations Johannes Schindelin
2022-08-19 10:19               ` Michael J Gruber

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8rntcr8x.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@grubix.eu \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).