tl;dr version: diff.{type}.xfuncname starts searching backwards in
from the beginning of the hunk, not the first differing line.

  $ mkdir tmp
  $ cd tmp
  $ git init
  $ cat > foo.c <<EOF
  int call_me(int maybe)

  int main()
  $ git add foo.c
  $ git commit -m "Initial checkin"
  $ ed foo.c
  # main() should return 0
    return 0;
  $ git diff

The diff returns a header line of

  @@ -4,4 +4,5 @@ int call_me(int maybe)

   int main()
  +  return 0;

misleadingly suggesting that the diff occurred in the call_me()
function, rather than in main()

I'm running from Debian Stable if that makes a difference.

Is this expected/proper behavior?


FWIW, I stumbled across this tinkering with
diff.{typename}.xfuncname detailed in gitattributes(5)

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to