summaryrefslogtreecommitdiffhomepage
path: root/.gitattributes
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2022-10-25 20:11:32 +0100
committerAndrew Clayton <a.clayton@nginx.com>2022-10-26 01:23:02 +0100
commit7a928b33b475f726fab2f9d1397db87756da6135 (patch)
tree46c3c07eec0d90766ebce287cfeec8f68bc89fca /.gitattributes
parente096f19d47e45803d12a9c60ee51f79d2613281c (diff)
downloadunit-7a928b33b475f726fab2f9d1397db87756da6135.tar.gz
unit-7a928b33b475f726fab2f9d1397db87756da6135.tar.bz2
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: <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=218dd85887da3d7d08119de18e9d325fcf30d7a4> Link: <https://git.kernel.org/pub/scm/git/git.git/commit/?id=e82675a040d559c56be54255901138a979eeec21> Reviewed-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '.gitattributes')
-rw-r--r--.gitattributes2
1 files changed, 2 insertions, 0 deletions
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