On 2022/03/19 1:14, Philippe Mathieu-Daudé wrote:
Commit 29cf16db23 says:
Since commits 0979ed017f0 ("meson: rename .inc.h files to .h.inc")
and 139c1837db7 ("meson: rename included C source files to .c.inc")
'git-diff --function-context' stopped displaying C function context
correctly.
So I suspect Git has some knowledge of common file extensions like .c,
.h and .m although I couldn't find in the source code of Git.
'git-diff --function-context' doesn't work for me without this change.
With some debugging, I found Apple's Git distribution actually carries a
default gitattributes file which annotates *.m.
https://github.com/apple-opensource/Git/blob/master/gitattributes
However, it does not annotate *.c or *.h. Apparently there is no "c"
diff pattern and they are handled with the "default" diff pattern which
is actually designed for C. In fact, "c" diff pattern is not present in
the documentation:
https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver
In conclusion, *.m should be listed in gitattributes but *.c.inc and
*.h.inc should not be if my understanding is correct.
Paolo Bonzini, I found you are the author of commit 29cf16db23. Can you
test the above conclusion?
Regards,
Akihiko Odaki