* [Question] How to parse range-diff output
@ 2024-02-26 7:25 ZheNing Hu
2024-02-26 13:16 ` Kristoffer Haugsbakk
0 siblings, 1 reply; 4+ messages in thread
From: ZheNing Hu @ 2024-02-26 7:25 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Christian Couder, Johannes Schindelin
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Question] How to parse range-diff output
2024-02-26 7:25 [Question] How to parse range-diff output ZheNing Hu
@ 2024-02-26 13:16 ` Kristoffer Haugsbakk
2024-02-26 16:16 ` Junio C Hamano
2024-02-29 11:00 ` ZheNing Hu
0 siblings, 2 replies; 4+ messages in thread
From: Kristoffer Haugsbakk @ 2024-02-26 13:16 UTC (permalink / raw)
To: ZheNing Hu
Cc: Junio C Hamano, Christian Couder, Johannes Schindelin, Git List
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.
--
Kristoffer Haugsbakk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Question] How to parse range-diff output
2024-02-26 13:16 ` Kristoffer Haugsbakk
@ 2024-02-26 16:16 ` Junio C Hamano
2024-02-29 11:00 ` ZheNing Hu
1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2024-02-26 16:16 UTC (permalink / raw)
To: Kristoffer Haugsbakk
Cc: ZheNing Hu, Christian Couder, Johannes Schindelin, Git List
"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes:
> 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.
Good point.
In fact, those "##" things came long after the command was
introduced for exactly the purpose of helping human users to locate
which part of a "diff" the "diff of diff" is talking about, and the
output from the command has been unstable for the exact reason.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Question] How to parse range-diff output
2024-02-26 13:16 ` Kristoffer Haugsbakk
2024-02-26 16:16 ` Junio C Hamano
@ 2024-02-29 11:00 ` ZheNing Hu
1 sibling, 0 replies; 4+ messages in thread
From: ZheNing Hu @ 2024-02-29 11:00 UTC (permalink / raw)
To: Kristoffer Haugsbakk
Cc: Junio C Hamano, Christian Couder, Johannes Schindelin, Git List
Kristoffer Haugsbakk <code@khaugsbakk.name> 于2024年2月26日周一 21:16写道:
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-29 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 7:25 [Question] How to parse range-diff output ZheNing Hu
2024-02-26 13:16 ` Kristoffer Haugsbakk
2024-02-26 16:16 ` Junio C Hamano
2024-02-29 11:00 ` ZheNing Hu
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 NNTP newsgroup(s).