From 7a928b33b475f726fab2f9d1397db87756da6135 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Tue, 25 Oct 2022 20:11:32 +0100 Subject: Set git diff driver for C source code files. Git can be told to apply language-specific rules when generating diffs. Enable this for C source code files (*.c and *.h) so that function names are printed right. Specifically, doing so prevents "git diff" from mistakenly considering unindented goto labels as function names. This has the same effect as adding [diff "default"] xfuncname = "^[[:alpha:]$_].*[^:]$" to your git config file. e.g get @@ -10,7 +10,7 @@ int main(void) instead of @@ -10,7 +10,7 @@ again: This makes use of the gitattributes(5) infrastructure. Link: Link: Reviewed-by: Alejandro Colomar Signed-off-by: Andrew Clayton --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes (limited to '.gitattributes') diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..45ec5156 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.c diff=cpp +*.h diff=cpp -- cgit