{"thread":{"id":"48772","subject":"Incorrect unified diff when run with \"--find-copies-harder\"","startedAt":"2018-06-24T10:36:51Z","lastAt":"2018-06-24T14:42:58Z","messageCount":3,"participants":["Daniel Penkin","Andrei Rybak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"350797","messageId":"CAL78Jw0mQWxO4xkzFBoG0Oe4wjomUGj=dP5ufdUrE5Ku0GGEtg@mail.gmail.com","threadId":"48772","inReplyTo":null,"subject":"Incorrect unified diff when run with \"--find-copies-harder\"","fromName":"Daniel Penkin","fromEmail":"dpenkin@gmail.com","sentAt":"2018-06-24T10:36:36Z","receivedAt":"2018-06-24T10:36:51Z","isPatch":false,"sender":{"key":"dpenkin@gmail.com","avatar":null},"body":"Hello,\n\nI believe I found a bug in how Git represents a diff when invoked with\n\"--find-copies-harder\" parameter.\nSpecifically, the unified diff header of a hunk contains an extra\npiece of text which appears to be a line from the context (i.e.\nunchanged line), something like this:\n\n    > git diff --find-copies-harder d00ca3f 20fb313\n    diff --git a/test.txt b/copy.txt\n    similarity index 81%\n    copy from test.txt\n    copy to copy.txt\n    index 734156d..43a3f9d 100644\n    --- a/test.txt\n    +++ b/copy.txt\n    @@ -2,6 +2,7 @@ line 1\n     line 2\n     line 3\n     line 4\n    +added line\n     line 5\n     line 6\n     line 7\n\nNote \"line 1\" after the standard unified diff header.\n\nI prepared a sample repository with a minimal file I can reproduce\nthis problem with:\nhttps://bitbucket.org/dpenkin/find-copies-harder-bug\n\nI'm running Git 2.18.0 on a macOS, but I also tried with Git 2.15.0\nand 2.8.6 running on Alpine Linux and was able to reproduce the same\nproblem.\n\nPlease advise whether this is expected output or is indeed a bug.\n\nThank you.\n\nKind regards,\nDaniil Penkin\n"},{"id":"350800","messageId":"6d5d2536-0f69-544d-23c7-351e8618ba94@gmail.com","threadId":"48772","inReplyTo":"CAL78Jw0mQWxO4xkzFBoG0Oe4wjomUGj=dP5ufdUrE5Ku0GGEtg@mail.gmail.com","subject":"Re: Incorrect unified diff when run with \"--find-copies-harder\"","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2018-06-24T13:33:05Z","receivedAt":"2018-06-24T13:33:11Z","isPatch":false,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"On 2018-06-24 12:36, Daniel Penkin wrote:\n> Hello,\n> \n\nHi,\n\n> I believe I found a bug in how Git represents a diff when invoked with\n> \"--find-copies-harder\" parameter.\n> Specifically, the unified diff header of a hunk contains an extra\n> piece of text which appears to be a line from the context (i.e.\n> unchanged line), something like this:\n> \n>     > git diff --find-copies-harder d00ca3f 20fb313\n>     diff --git a/test.txt b/copy.txt\n>     similarity index 81%\n>     copy from test.txt\n>     copy to copy.txt\n>     index 734156d..43a3f9d 100644\n>     --- a/test.txt\n>     +++ b/copy.txt\n>     @@ -2,6 +2,7 @@ line 1\n>      line 2\n>      line 3\n>      line 4\n>     +added line\n>      line 5\n>      line 6\n>      line 7\n> \n> Note \"line 1\" after the standard unified diff header.\n> \n\nThis text after @@ is usually a function name in a programming language or\nsome other relevant part of hunk context, to help user navigate the diff more\neasily.  What you are getting is the default version of it, as it is just\ncomparing txt files.  You can read more about it in the documentation of \ngitattributes:\n\nhttps://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header\n\n> I prepared a sample repository with a minimal file I can reproduce\n> this problem with:\n> https://bitbucket.org/dpenkin/find-copies-harder-bug\n> \n> I'm running Git 2.18.0 on a macOS, but I also tried with Git 2.15.0\n> and 2.8.6 running on Alpine Linux and was able to reproduce the same\n> problem.\n> \n> Please advise whether this is expected output or is indeed a bug.\n> \n\nThis is expected output.\n\n> Thank you.\n> \n> Kind regards,\n> Daniil Penkin\n> \n\n--\nBest regards, Andrei R.\n"},{"id":"350802","messageId":"CAL78Jw2v9sRznn0dfX+KMAT5TvsDCJ529-d1SahAKo0rmkfrxg@mail.gmail.com","threadId":"48772","inReplyTo":"6d5d2536-0f69-544d-23c7-351e8618ba94@gmail.com","subject":"Re: Incorrect unified diff when run with \"--find-copies-harder\"","fromName":"Daniel Penkin","fromEmail":"dpenkin@gmail.com","sentAt":"2018-06-24T14:42:43Z","receivedAt":"2018-06-24T14:42:58Z","isPatch":false,"sender":{"key":"dpenkin@gmail.com","avatar":null},"body":"Hi Andrei,\n\nThanks for the prompt reply.\n\nI'm sorry for the false alarm, I should've investigated this more\nthoroughly before submitting a bug.\nNow I see I get that context hint in many diffs, I was confused by\nmany simple file diffs I was working with recently which didn't have\nit.\n\nThank you for your time and help.\n\nKind regards,\nDaniil Penkin\n\nвс, 24 июн. 2018 г. в 23:33, Andrei Rybak <rybak.a.v@gmail.com>:\n>\n> On 2018-06-24 12:36, Daniel Penkin wrote:\n> > Hello,\n> >\n>\n> Hi,\n>\n> > I believe I found a bug in how Git represents a diff when invoked with\n> > \"--find-copies-harder\" parameter.\n> > Specifically, the unified diff header of a hunk contains an extra\n> > piece of text which appears to be a line from the context (i.e.\n> > unchanged line), something like this:\n> >\n> >     > git diff --find-copies-harder d00ca3f 20fb313\n> >     diff --git a/test.txt b/copy.txt\n> >     similarity index 81%\n> >     copy from test.txt\n> >     copy to copy.txt\n> >     index 734156d..43a3f9d 100644\n> >     --- a/test.txt\n> >     +++ b/copy.txt\n> >     @@ -2,6 +2,7 @@ line 1\n> >      line 2\n> >      line 3\n> >      line 4\n> >     +added line\n> >      line 5\n> >      line 6\n> >      line 7\n> >\n> > Note \"line 1\" after the standard unified diff header.\n> >\n>\n> This text after @@ is usually a function name in a programming language or\n> some other relevant part of hunk context, to help user navigate the diff more\n> easily.  What you are getting is the default version of it, as it is just\n> comparing txt files.  You can read more about it in the documentation of\n> gitattributes:\n>\n> https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header\n>\n> > I prepared a sample repository with a minimal file I can reproduce\n> > this problem with:\n> > https://bitbucket.org/dpenkin/find-copies-harder-bug\n> >\n> > I'm running Git 2.18.0 on a macOS, but I also tried with Git 2.15.0\n> > and 2.8.6 running on Alpine Linux and was able to reproduce the same\n> > problem.\n> >\n> > Please advise whether this is expected output or is indeed a bug.\n> >\n>\n> This is expected output.\n>\n> > Thank you.\n> >\n> > Kind regards,\n> > Daniil Penkin\n> >\n>\n> --\n> Best regards, Andrei R.\n"}]}