public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] add basic .gitattributes files to notice whitespace issues
@ 2016-02-05  2:06 tbsaunde+gcc
  2016-02-05 15:35 ` David Malcolm
  2016-04-22  5:26 ` Jeff Law
  0 siblings, 2 replies; 4+ messages in thread
From: tbsaunde+gcc @ 2016-02-05  2:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: law

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

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
-- 
2.7.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add basic .gitattributes files to notice whitespace issues
  2016-02-05  2:06 [PATCH] add basic .gitattributes files to notice whitespace issues tbsaunde+gcc
@ 2016-02-05 15:35 ` David Malcolm
  2016-02-05 15:44   ` Trevor Saunders
  2016-04-22  5:26 ` Jeff Law
  1 sibling, 1 reply; 4+ messages in thread
From: David Malcolm @ 2016-02-05 15:35 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches; +Cc: law

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add basic .gitattributes files to notice whitespace issues
  2016-02-05 15:35 ` David Malcolm
@ 2016-02-05 15:44   ` Trevor Saunders
  0 siblings, 0 replies; 4+ messages in thread
From: Trevor Saunders @ 2016-02-05 15:44 UTC (permalink / raw)
  To: David Malcolm; +Cc: tbsaunde+gcc, gcc-patches, law

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add basic .gitattributes files to notice whitespace issues
  2016-02-05  2:06 [PATCH] add basic .gitattributes files to notice whitespace issues tbsaunde+gcc
  2016-02-05 15:35 ` David Malcolm
@ 2016-04-22  5:26 ` Jeff Law
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Law @ 2016-04-22  5:26 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-22  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05  2:06 [PATCH] add basic .gitattributes files to notice whitespace issues tbsaunde+gcc
2016-02-05 15:35 ` David Malcolm
2016-02-05 15:44   ` Trevor Saunders
2016-04-22  5:26 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).