{"thread":{"id":"31308","subject":"misleading diff-hunk header","startedAt":"2012-08-21T13:21:04Z","lastAt":"2012-08-21T13:21:04Z","messageCount":1,"participants":["Tim Chase"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"197529","messageId":"50338B40.9050606@tim.thechases.com","threadId":"31308","inReplyTo":null,"subject":"misleading diff-hunk header","fromName":"Tim Chase","fromEmail":"git@tim.thechases.com","sentAt":"2012-08-21T13:21:04Z","receivedAt":"2012-08-21T13:21:04Z","isPatch":false,"sender":{"key":"git@tim.thechases.com","avatar":null},"body":"[posted originally to git-users@ but advised this would be a better\nforum]\n\ndiff.{type}.xfuncname seems to start searching backwards in\nfrom the beginning of the hunk, not the first differing line.\n\nTo reproduce:\n\n  $ mkdir tmp\n  $ cd tmp\n  $ git init\n  $ cat > foo.c <<EOF\n  int call_me(int maybe)\n  {\n  }\n\n  int main()\n  {\n  }\n  EOF\n  $ git add foo.c\n  $ git commit -m \"Initial checkin\"\n  $ ed foo.c\n  # main() should return 0\n  $i\n    return 0;\n  .\n  wq\n  $ git diff\n\nThe diff returns a header line of\n\n  @@ -4,4 +4,5 @@ int call_me(int maybe)\n\n   int main()\n   {\n  +  return 0;\n   }\n\nmisleadingly suggesting that the change occurred in the call_me()\nfunction, rather than in main()\n\nI'm running 1.7.2.5 from Debian Stable if that makes a difference.\n\nIs this expected/proper behavior?\n\n-tkc\n\nFWIW, I stumbled across this tinkering with\ndiff.{typename}.xfuncname detailed in gitattributes(5)\n"}]}