1
0
mirror of https://github.com/postgres/postgres.git synced 2026-01-26 09:41:40 +03:00

Add script to keep .editorconfig in sync with .gitattributes

Our repo already contained an .editorconfig file, but it was not kept
up to date with .gitattributes.  This adds a script that keeps these
files in sync.  A big advantage of the editorconfig file is that it
many editors/IDEs get automatically configured to trim trailing
newlines and add a final newline on save, while .gitattributes only
complains about these problems instead of automatically fixing them.

This also adds rules to .gitattributes for Python files as well as for
C files in pg_bsd_indent directory (which have a different tab_width
than most C files due to being vendored in).

Author: Jelte Fennema-Nio <github-tech@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQQGzbroAXi+Yicp3HvcCo4=g84kaOgjuvQ5MW9F0ubOGg@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2025-02-01 10:01:16 +01:00
parent 79e872fedb
commit 2452e71ff2
3 changed files with 266 additions and 5 deletions

7
.gitattributes vendored
View File

@@ -1,11 +1,15 @@
# IMPORTANT: After updating this file, also run src/tools/generate_editorconfig.py
* whitespace=space-before-tab,trailing-space
*.[chly] whitespace=space-before-tab,trailing-space,indent-with-non-tab,tabwidth=4
*.cpp whitespace=space-before-tab,trailing-space,indent-with-non-tab,tabwidth=4
*.pl whitespace=space-before-tab,trailing-space,tabwidth=4
*.pm whitespace=space-before-tab,trailing-space,tabwidth=4
*.po whitespace=space-before-tab,trailing-space,tab-in-indent,-blank-at-eof
*.py whitespace=space-before-tab,trailing-space,tab-in-indent
*.sgml whitespace=space-before-tab,trailing-space,tab-in-indent
*.x[ms]l whitespace=space-before-tab,trailing-space,tab-in-indent
*.xml whitespace=space-before-tab,trailing-space,tab-in-indent
*.xsl whitespace=space-before-tab,trailing-space,tab-in-indent
# Avoid confusing ASCII underlines with leftover merge conflict markers
README conflict-marker-size=32
@@ -33,3 +37,4 @@ src/include/snowball/libstemmer/* -whitespace
src/timezone/data/* -whitespace
src/tools/pg_bsd_indent/* -whitespace
src/tools/pg_bsd_indent/tests/* -whitespace
src/tools/pg_bsd_indent/*.[ch] whitespace=-blank-at-eol,-blank-at-eof,tabwidth=8