{"thread":{"id":"61006","subject":"[Question] How to parse range-diff output","startedAt":"2024-02-26T07:25:29Z","lastAt":"2024-02-29T11:01:03Z","messageCount":4,"participants":["ZheNing Hu","Kristoffer Haugsbakk","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"489354","messageId":"CAOLTT8SQyBSWC=aqB2SRYmp3kR6RZ+L_-9yckWQf-X9rbzeNBw@mail.gmail.com","threadId":"61006","inReplyTo":null,"subject":"[Question] How to parse range-diff output","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2024-02-26T07:25:16Z","receivedAt":"2024-02-26T07:25:29Z","isPatch":false,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Hi,\n\nI am currently looking to implement a service that provides a version\nrange comparison based on git range-diff. I can easily parse out\ncommit pair headers like \"3: 0bf6289 ! 3: a076e88 dev5,\" but I am\nunsure how to parse the details in the subsequent diff patch body.\n\nIt is not a standard diff output where one can parse out the filename\nfrom the diff header, It should be called a diff of diffs. We can see\nvarious headers with file names such as \"@@ File1 (new)\", \"## File2\n(new) ##\", or \"@@ File3: function3\" in different formats. This is\nconfusing. How should we correctly parse a range-diff patch, and do\nyou have any good suggestions?\n\nThanks for any help.\n--\nZheNing Hu\n"},{"id":"489371","messageId":"11783b8e-472d-4b75-bb48-88138daf16ae@app.fastmail.com","threadId":"61006","inReplyTo":"CAOLTT8SQyBSWC=aqB2SRYmp3kR6RZ+L_-9yckWQf-X9rbzeNBw@mail.gmail.com","subject":"Re: [Question] How to parse range-diff output","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-02-26T13:16:06Z","receivedAt":"2024-02-26T13:16:28Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Mon, Feb 26, 2024, at 08:25, ZheNing Hu wrote:\n> Hi,\n>\n> I am currently looking to implement a service that provides a version\n> range comparison based on git range-diff. I can easily parse out\n> commit pair headers like \"3: 0bf6289 ! 3: a076e88 dev5,\" but I am\n> unsure how to parse the details in the subsequent diff patch body.\n>\n> It is not a standard diff output where one can parse out the filename\n> from the diff header, It should be called a diff of diffs. We can see\n> various headers with file names such as \"@@ File1 (new)\", \"## File2\n> (new) ##\", or \"@@ File3: function3\" in different formats. This is\n> confusing. How should we correctly parse a range-diff patch, and do\n> you have any good suggestions?\n>\n> Thanks for any help.\n> --\n> ZheNing Hu\n\nHi\n\nNote that “Output Stability” says that this output is not meant to be\nmachine-readable. It’s for human consumption. It’s not textually stable.\n\nSo a new version of Git might break your implementation without warning.\n\n-- \nKristoffer Haugsbakk\n"},{"id":"489382","messageId":"xmqqmsrnfbfh.fsf@gitster.g","threadId":"61006","inReplyTo":"11783b8e-472d-4b75-bb48-88138daf16ae@app.fastmail.com","subject":"Re: [Question] How to parse range-diff output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-02-26T16:16:34Z","receivedAt":"2024-02-26T16:16:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kristoffer Haugsbakk\" <code@khaugsbakk.name> writes:\n\n> On Mon, Feb 26, 2024, at 08:25, ZheNing Hu wrote:\n>> Hi,\n>>\n>> I am currently looking to implement a service that provides a version\n>> range comparison based on git range-diff. I can easily parse out\n>> commit pair headers like \"3: 0bf6289 ! 3: a076e88 dev5,\" but I am\n>> unsure how to parse the details in the subsequent diff patch body.\n>>\n>> It is not a standard diff output where one can parse out the filename\n>> from the diff header, It should be called a diff of diffs. We can see\n>> various headers with file names such as \"@@ File1 (new)\", \"## File2\n>> (new) ##\", or \"@@ File3: function3\" in different formats. This is\n>> confusing. How should we correctly parse a range-diff patch, and do\n>> you have any good suggestions?\n>>\n>> Thanks for any help.\n>> --\n>> ZheNing Hu\n>\n> Hi\n>\n> Note that “Output Stability” says that this output is not meant to be\n> machine-readable. It’s for human consumption. It’s not textually stable.\n>\n> So a new version of Git might break your implementation without warning.\n\nGood point.\n\nIn fact, those \"##\" things came long after the command was\nintroduced for exactly the purpose of helping human users to locate\nwhich part of a \"diff\" the \"diff of diff\" is talking about, and the\noutput from the command has been unstable for the exact reason.\n\n"},{"id":"489657","messageId":"CAOLTT8Sn89Qq68YpTCsiK+_WAPdrsTN1xWxpkuEbhwBWpZgK=A@mail.gmail.com","threadId":"61006","inReplyTo":"11783b8e-472d-4b75-bb48-88138daf16ae@app.fastmail.com","subject":"Re: [Question] How to parse range-diff output","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2024-02-29T11:00:50Z","receivedAt":"2024-02-29T11:01:03Z","isPatch":false,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> 于2024年2月26日周一 21:16写道：\n>\n> On Mon, Feb 26, 2024, at 08:25, ZheNing Hu wrote:\n> > Hi,\n> >\n> > I am currently looking to implement a service that provides a version\n> > range comparison based on git range-diff. I can easily parse out\n> > commit pair headers like \"3: 0bf6289 ! 3: a076e88 dev5,\" but I am\n> > unsure how to parse the details in the subsequent diff patch body.\n> >\n> > It is not a standard diff output where one can parse out the filename\n> > from the diff header, It should be called a diff of diffs. We can see\n> > various headers with file names such as \"@@ File1 (new)\", \"## File2\n> > (new) ##\", or \"@@ File3: function3\" in different formats. This is\n> > confusing. How should we correctly parse a range-diff patch, and do\n> > you have any good suggestions?\n> >\n> > Thanks for any help.\n> > --\n> > ZheNing Hu\n>\n> Hi\n>\n> Note that “Output Stability” says that this output is not meant to be\n> machine-readable. It’s for human consumption. It’s not textually stable.\n>\n> So a new version of Git might break your implementation without warning.\n>\n\nIt is very regrettable that some crucial metadata from the range-diff\npatch cannot be extracted. I can only hope that future range-diff will have\nthe capability of being machine-readable. Thank you!\n\n> --\n> Kristoffer Haugsbakk\n"}]}