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

Re: [RFC PATCH 3/4] range-diff: add section header instead of diff header

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 15, 2019, 06:28 UTC
Message-ID
<46e31ffc-60f6-1aef-5159-6796b7f13294@kdbg.org>
In-Reply-To
<CAPig+cTJyYLGAfHM_PrZd9DDaZBcVUetcWFcANGCYPvaMh2qxA@mail.gmail.com>
Am 15.04.19 um 01:29 schrieb Eric Sunshine:
Show 26 quoted lines
> On Sun, Apr 14, 2019 at 5:10 PM Thomas Gummerer <t.gummerer@gmail.com> wrote:
>> +                               strbuf_remove(&line, 0, 4);
>> +                       if (!strcmp(filename_a.buf, "/dev/null")) {
>> +                               strbuf_addstr(&buf, "new file ");
>> +                               strbuf_addbuf(&buf, &line);
>> +                       } else if (!strcmp(line.buf, "/dev/null")) {
>> +                               strbuf_addstr(&buf, "removed file ");
>> +                               strbuf_addbuf(&buf, &line);
>> +                       } else if (strbuf_cmp(&filename_a, &line)) {
>> +                               strbuf_addstr(&buf, "renamed file ");
>> +                               strbuf_addbuf(&buf, &filename_a);
>> +                               strbuf_addstr(&buf, " -> ");
>> +                               strbuf_addbuf(&buf, &line);
>> +                       } else {
>> +                               strbuf_addstr(&buf, "modified file ");
>> +                               strbuf_addbuf(&buf, &line);
>> +                       }
> 
> All of these disposition strings end with "file", which seems
> redundant. Short and sweet "new", "removed", "renamed", "modified"
> provide just as much useful information.
> 
> Also, should these strings be localizable? Alternately, rather than
> using prose to describe the disposition, perhaps do so symbolically
> (thus universally), say with "+", "-", "->", "*" (or ""),
> respectively?

When the strings are translated, it would be preferable to not do this sentence lego at all and have format strings that are filled with the values.

Then the noise word "file" is probably not that bad, in particular, when translators tend to not add words that they don't see in the original. For example, German translations of "new %s" I anticipate "neues %s", "%s (neu)", "neu %s", all of which are awkward, but translations of "new file %s" lends itself naturally to "neue Datei %s", which is fine.

-- Hannes
Previous: Eric SunshineNext: Johannes Schindelin
Message 22 of 29 in “incorrect range-diff output?”
  1. Duy NguyenApr 11, 2019
  2. Thomas GummererApr 11, 2019
  3. Johannes SchindelinApr 12, 2019
  4. Thomas GummererApr 14, 2019
  5. Duy NguyenApr 12, 2019
  6. Junio C HamanoApr 12, 2019
  7. Thomas GummererApr 14, 2019
  8. Junio C HamanoApr 15, 2019
  9. Johannes SchindelinApr 15, 2019
  10. 0/4 output improvements for git range-diffThomas Gummerer, Apr 14, 2019
  11. 1/4 range-diff: fix function parameter indentationThomas Gummerer, Apr 14, 2019
  12. 2/4 range-diff: don't remove funcname from inner diffThomas Gummerer, Apr 14, 2019
  13. Eric SunshineApr 14, 2019
  14. Johannes SchindelinApr 15, 2019
  15. Thomas GummererApr 15, 2019
  16. Johannes SchindelinApr 17, 2019
  17. Thomas GummererApr 24, 2019
  18. Johannes SchindelinApr 15, 2019
  19. Thomas GummererApr 15, 2019
  20. 3/4 range-diff: add section header instead of diff headerThomas Gummerer, Apr 14, 2019
  21. Eric SunshineApr 14, 2019
  22. Johannes SixtApr 15, 2019
  23. Johannes SchindelinApr 15, 2019
  24. Thomas GummererApr 15, 2019
  25. 4/4 range-diff: add section headers to the outer hunk headerThomas Gummerer, Apr 14, 2019
  26. Johannes SchindelinApr 15, 2019
  27. Thomas GummererApr 15, 2019
  28. Johannes SchindelinApr 15, 2019
  29. Thomas GummererApr 15, 2019

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.