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

Re: [Question] How to parse range-diff output

From
ZheNing Hu <adlternative@gmail.com>
Date
Feb 29, 2024, 11:00 UTC
Message-ID
<CAOLTT8Sn89Qq68YpTCsiK+_WAPdrsTN1xWxpkuEbhwBWpZgK=A@mail.gmail.com>
In-Reply-To
<11783b8e-472d-4b75-bb48-88138daf16ae@app.fastmail.com>
Kristoffer Haugsbakk <code@khaugsbakk.name> 于2024年2月26日周一 21:16写道:
Show 27 quoted lines
>
> On Mon, Feb 26, 2024, at 08:25, ZheNing Hu wrote:
> > Hi,
> >
> > I am currently looking to implement a service that provides a version
> > range comparison based on git range-diff. I can easily parse out
> > commit pair headers like "3: 0bf6289 ! 3: a076e88 dev5," but I am
> > unsure how to parse the details in the subsequent diff patch body.
> >
> > It is not a standard diff output where one can parse out the filename
> > from the diff header, It should be called a diff of diffs. We can see
> > various headers with file names such as "@@ File1 (new)", "## File2
> > (new) ##", or "@@ File3: function3" in different formats. This is
> > confusing. How should we correctly parse a range-diff patch, and do
> > you have any good suggestions?
> >
> > Thanks for any help.
> > --
> > ZheNing Hu
>
> Hi
>
> Note that “Output Stability” says that this output is not meant to be
> machine-readable. It’s for human consumption. It’s not textually stable.
>
> So a new version of Git might break your implementation without warning.
>

It is very regrettable that some crucial metadata from the range-diff patch cannot be extracted. I can only hope that future range-diff will have the capability of being machine-readable. Thank you!

> --
> Kristoffer Haugsbakk
Previous: Junio C Hamano
Message 4 of 4 in “[Question] How to parse range-diff output”
  1. ZheNing HuFeb 26, 2024
  2. Kristoffer HaugsbakkFeb 26, 2024
  3. Junio C HamanoFeb 26, 2024
  4. ZheNing HuFeb 29, 2024

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.