[PATCH 4/5] [pre-commit] Don't require text type for check-whitespace hook
Tom de Vries <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
The check-whitespace hook has a line:
...
types: ['text']
...
Drop this, to make the check-whitespace hook see the same files as git usage
outside pre-commit:
...
$ git diff-index --cached --check $(git hash-object -t tree /dev/null) gdb*
...
Instead, add .gitattributes files in gdb/doc and gdb/testsuite.
https://sourceware.org/bugzilla/show_bug.cgi?id=34411
---
.pre-commit-config.yaml | 5 ++++-
gdb/doc/.gitattributes | 10 ++++++++++
gdb/testsuite/.gitattributes | 4 ++++
3 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 gdb/doc/.gitattributes
create mode 100644 gdb/testsuite/.gitattributes
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b437593b228..260cae67e56 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -129,7 +129,10 @@ repos:
name: *id2
language: unsupported_script
entry: gdb/contrib/check-whitespace-pre-commit.py
- types: ['text']
+ # Don't filter files on types, allowing this hook to see same files as
+ # git usage outside pre-commit. Instead, filter files in the entry point.
+ types: *types_default
+ types_or: *types_or_default
files: *gdb_files
- id: &id3 pre-commit-setup
name: *id3
diff --git a/gdb/doc/.gitattributes b/gdb/doc/.gitattributes
new file mode 100644
index 00000000000..735e4eef89a
--- /dev/null
+++ b/gdb/doc/.gitattributes
@@ -0,0 +1,10 @@
+# -*- conf -*-
+
+# Binary format.
+*.pdf binary
+*.png binary
+
+# Text format, but diffs aren't useful.
+# Note that stack_frame.eps is an EPS file without embedded bitmap preview.
+*.svg text -diff
+stack_frame.eps text -diff
diff --git a/gdb/testsuite/.gitattributes b/gdb/testsuite/.gitattributes
new file mode 100644
index 00000000000..97a376c1938
--- /dev/null
+++ b/gdb/testsuite/.gitattributes
@@ -0,0 +1,4 @@
+# -*- conf -*-
+
+# Binary format.
+*.bz2 binary
--
2.51.0