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

Re: [PATCH 4/5] interpret-trailers: add an option to normalize output

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 10, 2017, 21:06 UTC
Message-ID
<CAP8UFD08oyY9eK-0Ydm2qh2etvc2_QGc0ujNswGUgUumwhy4+w@mail.gmail.com>
In-Reply-To
<CAGZ79kYeNb3sN4b8xZvYAjQOXWKP9oi+dNsJmS8fyz+iUH9p8A@mail.gmail.com>
On Thu, Aug 10, 2017 at 9:44 PM, Stefan Beller <sbeller@google.com> wrote:
Show 36 quoted lines
> On Thu, Aug 10, 2017 at 12:39 PM, Christian Couder
> <christian.couder@gmail.com> wrote:
>> On Thu, Aug 10, 2017 at 8:37 PM, Jeff King <peff@peff.net> wrote:
>>> On Thu, Aug 10, 2017 at 11:35:00AM -0700, Stefan Beller wrote:
>>>
>>>> On Thu, Aug 10, 2017 at 1:03 AM, Jeff King <peff@peff.net> wrote:
>>>> > The point of "--only-trailers" is to give a caller an output
>>>> > that's easy for them to parse. Getting rid of the
>>>> > non-trailer material helps, but we still may see more
>>>> > complicated syntax like whitespace continuation. Let's add
>>>> > an option to normalize the output into one "key: value" line
>>>> > per trailer.
>>>> >
>>>> > As a bonus, this could be used even without --only-trailers
>>>> > to clean up unusual formatting in the incoming data.
>>>>
>>>> This is useful for the parsing part, but for the writing part we'd
>>>> rather want to have the opposite thing, such as
>>>> '--line-break=rfc822'. But this doesn't have to be part of this
>>>> series. With this in mind, I do not quite understand the latter
>>>> use case how you would use normalized trailers without
>>>> --only-trailers?
>>>
>>> If you prefer the normalized form (and the input was line-broken in a
>>> way that you don't like), then this would convert to your preferred
>>> form. I agree that you could potentially want the opposite (folding long
>>> lines). Perhaps something like --wrap=72.
>>
>> Related to this, I wonder if people might want to "normalize" in
>> different ways later. If that happens, we might regret having called
>> this option "--normalize" instead of "--one-per-line" for example.
>
> What is normal?
>
> Maybe --style=[one-line, wrapped:72, rfc, json, xml, ...]
> then?

Yeah, we could go there right now (using perhaps "--pretty" or "--format" instead of "--style", so that we are more consistent with other commands), but on the other hand we don't know yet if the other formats will really be needed.

Show 6 quoted lines
> If you have --one-per-line, this may be orthogonal to e.g. json
> (as json can be crammed into one line IIUC), but when given the
> selection you cannot combine multiple styles.
>
> Scratch that, we actually want to combine these styles with each
> other.

Yeah, that's another possibility for the future. People might want a --json option that can be used both with and without --oneline. But as the future is difficult to predict, let's try to make it easy for us in both cases.

And I think starting with just "--oneline" would be easier to deal with later than "--normalize" (or "--style" or "--pretty" or "--format") especially in the latter case.

Previous: Stefan BellerNext: Jeff King
Message 37 of 68 in “make interpret-trailers useful for parsing”
  1. 0/5 make interpret-trailers useful for parsingJeff King, Aug 9, 2017
  2. 1/5 trailer: put process_trailers() options into a structJeff King, Aug 9, 2017
  3. 2/5 interpret-trailers: add an option to show only the trailersJeff King, Aug 9, 2017
  4. Stefan BellerAug 9, 2017
  5. Stefan BellerAug 9, 2017
  6. Jonathan TanAug 9, 2017
  7. Jeff KingAug 10, 2017
  8. 3/5 interpret-trailers: add an option to show only existing trailersJeff King, Aug 9, 2017
  9. Stefan BellerAug 9, 2017
  10. Jeff KingAug 10, 2017
  11. Stefan BellerAug 10, 2017
  12. Jeff KingAug 10, 2017
  13. Stefan BellerAug 10, 2017
  14. Junio C HamanoAug 10, 2017
  15. Jonathan TanAug 9, 2017
  16. Jeff KingAug 10, 2017
  17. 4/5 interpret-trailers: add an option to normalize outputJeff King, Aug 9, 2017
  18. 5/5 interpret-trailers: add --parse convenience optionJeff King, Aug 9, 2017
  19. Stefan BellerAug 9, 2017
  20. Jeff KingAug 10, 2017
  21. Junio C HamanoAug 9, 2017
  22. Jacob KellerAug 10, 2017
  23. Jeff KingAug 10, 2017
  24. Junio C HamanoAug 10, 2017
  25. Jacob KellerAug 13, 2017
  26. Jeff KingAug 10, 2017
  27. 1/5 trailer: put process_trailers() options into a structJeff King, Aug 10, 2017
  28. 2/5 interpret-trailers: add an option to show only the trailersJeff King, Aug 10, 2017
  29. 3/5 interpret-trailers: add an option to show only existing trailersJeff King, Aug 10, 2017
  30. 4/5 interpret-trailers: add an option to normalize outputJeff King, Aug 10, 2017
  31. Stefan BellerAug 10, 2017
  32. Jeff KingAug 10, 2017
  33. Christian CouderAug 10, 2017
  34. Jeff KingAug 10, 2017
  35. Christian CouderAug 10, 2017
  36. Stefan BellerAug 10, 2017
  37. Christian CouderAug 10, 2017
  38. Jeff KingAug 10, 2017
  39. Ramsay JonesAug 10, 2017
  40. Jeff KingAug 10, 2017
  41. Ramsay JonesAug 10, 2017
  42. Christian CouderAug 11, 2017
  43. Jeff KingAug 11, 2017
  44. Christian CouderAug 11, 2017
  45. 5/5 interpret-trailers: add --parse convenience optionJeff King, Aug 10, 2017
  46. Jeff KingAug 10, 2017
  47. 1/5 trailer: put process_trailers() options into a structJeff King, Aug 10, 2017
  48. 2/5 interpret-trailers: add an option to show only the trailersJeff King, Aug 10, 2017
  49. Stefan BellerAug 10, 2017
  50. Jeff KingAug 10, 2017
  51. Junio C HamanoAug 10, 2017
  52. 3/5 interpret-trailers: add an option to show only existing trailersJeff King, Aug 10, 2017
  53. 4/5 interpret-trailers: add an option to normalize outputJeff King, Aug 10, 2017
  54. 5/5 interpret-trailers: add --parse convenience optionJeff King, Aug 10, 2017
  55. Stefan BellerAug 10, 2017
  56. Junio C HamanoAug 10, 2017
  57. 0/8 trailer parsing via interpret-trailers and %(trailers)Jeff King, Aug 15, 2017
  58. 1/8 trailer: put process_trailers() options into a structJeff King, Aug 15, 2017
  59. 2/8 interpret-trailers: add an option to show only the trailersJeff King, Aug 15, 2017
  60. 3/8 interpret-trailers: add an option to show only existing trailersJeff King, Aug 15, 2017
  61. 4/8 interpret-trailers: add an option to unfold valuesJeff King, Aug 15, 2017
  62. 5/8 interpret-trailers: add --parse convenience optionJeff King, Aug 15, 2017
  63. Martin ÅgrenAug 15, 2017
  64. Jeff KingAug 16, 2017
  65. Martin ÅgrenAug 17, 2017
  66. 6/8 pretty: move trailer formatting to trailer.cJeff King, Aug 15, 2017
  67. 7/8 t4205: refactor %(trailers) testsJeff King, Aug 15, 2017
  68. 8/8 pretty: support normalization options for %(trailers)Jeff King, Aug 15, 2017

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.