diff mbox

add basic .gitattributes files to notice whitespace issues

Message ID 1454637648-16238-1-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Feb. 5, 2016, 2 a.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

Hi,

We can tell git to highlight whitespace errors in diffs, and if you enable the
default pre-commit hook git won't allow you to make a commit with a whitespace
error violating the rules you told it about.  These files as are could be
improved some, they don't enforce  whitespace rules on testsuite .exp files, and
I'm not sure if we want to allow whitespace errors in testsuites for libraries,
but I'd like to see if other people can suggest other improvements.

Trev



gcc/testsuite/ChangeLog:

2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* .gitattributes: New file.

ChangeLog:

2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* .gitattributes: New file.
---
 .gitattributes               | 1 +
 gcc/testsuite/.gitattributes | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 gcc/testsuite/.gitattributes

Comments

David Malcolm Feb. 5, 2016, 3:33 p.m. UTC | #1
On Thu, 2016-02-04 at 21:00 -0500, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> 
> Hi,
> 
> We can tell git to highlight whitespace errors in diffs, and if you
> enable the
> default pre-commit hook git won't allow you to make a commit with a
> whitespace
> error violating the rules you told it about.  These files as are
> could be
> improved some, they don't enforce  whitespace rules on testsuite .exp
> files, and
> I'm not sure if we want to allow whitespace errors in testsuites for
> libraries,
> but I'd like to see if other people can suggest other improvements.

Does this only apply to changed lines in a commit?

Does the gcc/testsuite/.gitattributes file fully disable the top-level
one within gcc/testsuite?  Note that in the testsuite we'd want to have
the ability to have testcases with poor whitespace: in particular 
-Wmisleading-indentation needs to be able to be tested with poor
whitespace, and I suspect we'll want to add testcases for how well diag
nostics cope with mixed tabs and spaces etc.

> gcc/testsuite/ChangeLog:
> 
> 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> 
> 	* .gitattributes: New file.
> 
> ChangeLog:
> 
> 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> 
> 	* .gitattributes: New file.
> ---
>  .gitattributes               | 1 +
>  gcc/testsuite/.gitattributes | 1 +
>  2 files changed, 2 insertions(+)
>  create mode 100644 .gitattributes
>  create mode 100644 gcc/testsuite/.gitattributes
> 
> diff --git a/.gitattributes b/.gitattributes
> new file mode 100644
> index 0000000..b38d7f1
> --- /dev/null
> +++ b/.gitattributes
> @@ -0,0 +1 @@
> +*.{c,C,cc,h} whitespace=indent-with-non-tab,space-before
> -tab,trailing-space
> diff --git a/gcc/testsuite/.gitattributes
> b/gcc/testsuite/.gitattributes
> new file mode 100644
> index 0000000..562b12e
> --- /dev/null
> +++ b/gcc/testsuite/.gitattributes
> @@ -0,0 +1 @@
> +* -whitespace
Trevor Saunders Feb. 5, 2016, 3:42 p.m. UTC | #2
On Fri, Feb 05, 2016 at 10:33:51AM -0500, David Malcolm wrote:
> On Thu, 2016-02-04 at 21:00 -0500, tbsaunde+gcc@tbsaunde.org wrote:
> > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > 
> > Hi,
> > 
> > We can tell git to highlight whitespace errors in diffs, and if you
> > enable the
> > default pre-commit hook git won't allow you to make a commit with a
> > whitespace
> > error violating the rules you told it about.  These files as are
> > could be
> > improved some, they don't enforce  whitespace rules on testsuite .exp
> > files, and
> > I'm not sure if we want to allow whitespace errors in testsuites for
> > libraries,
> > but I'd like to see if other people can suggest other improvements.
> 
> Does this only apply to changed lines in a commit?

yes

> Does the gcc/testsuite/.gitattributes file fully disable the top-level
> one within gcc/testsuite?  Note that in the testsuite we'd want to have
> the ability to have testcases with poor whitespace: in particular 

yes, and this is the exact reason I did it.  Though I suspect we could
be stricter about the .exp files and the ChangeLogs, but something is
better than nothing.

Trev

> -Wmisleading-indentation needs to be able to be tested with poor
> whitespace, and I suspect we'll want to add testcases for how well diag
> nostics cope with mixed tabs and spaces etc.
> 
> > gcc/testsuite/ChangeLog:
> > 
> > 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > 
> > 	* .gitattributes: New file.
> > 
> > ChangeLog:
> > 
> > 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > 
> > 	* .gitattributes: New file.
> > ---
> >  .gitattributes               | 1 +
> >  gcc/testsuite/.gitattributes | 1 +
> >  2 files changed, 2 insertions(+)
> >  create mode 100644 .gitattributes
> >  create mode 100644 gcc/testsuite/.gitattributes
> > 
> > diff --git a/.gitattributes b/.gitattributes
> > new file mode 100644
> > index 0000000..b38d7f1
> > --- /dev/null
> > +++ b/.gitattributes
> > @@ -0,0 +1 @@
> > +*.{c,C,cc,h} whitespace=indent-with-non-tab,space-before
> > -tab,trailing-space
> > diff --git a/gcc/testsuite/.gitattributes
> > b/gcc/testsuite/.gitattributes
> > new file mode 100644
> > index 0000000..562b12e
> > --- /dev/null
> > +++ b/gcc/testsuite/.gitattributes
> > @@ -0,0 +1 @@
> > +* -whitespace
Jeff Law April 22, 2016, 5:26 a.m. UTC | #3
On 02/04/2016 07:00 PM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> Hi,
>
> We can tell git to highlight whitespace errors in diffs, and if you enable the
> default pre-commit hook git won't allow you to make a commit with a whitespace
> error violating the rules you told it about.  These files as are could be
> improved some, they don't enforce  whitespace rules on testsuite .exp files, and
> I'm not sure if we want to allow whitespace errors in testsuites for libraries,
> but I'd like to see if other people can suggest other improvements.
>
> Trev
>
>
>
> gcc/testsuite/ChangeLog:
>
> 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* .gitattributes: New file.
>
> ChangeLog:
>
> 2016-02-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* .gitattributes: New file.
OK.
jeff
diff mbox

Patch

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..b38d7f1
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@ 
+*.{c,C,cc,h} whitespace=indent-with-non-tab,space-before-tab,trailing-space
diff --git a/gcc/testsuite/.gitattributes b/gcc/testsuite/.gitattributes
new file mode 100644
index 0000000..562b12e
--- /dev/null
+++ b/gcc/testsuite/.gitattributes
@@ -0,0 +1 @@ 
+* -whitespace