Re: [PATCH 1/2] check-headers: add header usage checks for .c files

2014-09-15 Thread David Aguilar
On Mon, Sep 15, 2014 at 12:19:06PM -0700, Junio C Hamano wrote: > Junio C Hamano writes: > > > David Aguilar writes: > > > >> Teach check-header.sh to ensure that the first included header in .c > >> files is either git-compat-util.h, builtin.h, or cache.h. > >> > >> Ensure that common-cmds.h is

Re: [PATCH 1/2] check-headers: add header usage checks for .c files

2014-09-15 Thread Junio C Hamano
Junio C Hamano writes: > David Aguilar writes: > >> Teach check-header.sh to ensure that the first included header in .c >> files is either git-compat-util.h, builtin.h, or cache.h. >> >> Ensure that common-cmds.h is only included by help.c. >> >> Move the logic into functions so that we can ski

Re: [PATCH 1/2] check-headers: add header usage checks for .c files

2014-09-15 Thread Junio C Hamano
David Aguilar writes: > Teach check-header.sh to ensure that the first included header in .c > files is either git-compat-util.h, builtin.h, or cache.h. > > Ensure that common-cmds.h is only included by help.c. > > Move the logic into functions so that we can skip parts of the check. > > Signed-o

Re: [PATCH 1/2] check-headers: add header usage checks for .c files

2014-09-15 Thread Junio C Hamano
David Aguilar writes: > +check_header_usage () { > + first=$(grep '^#include' "$1" | > + head -n1 | > + sed -e 's,#include ",,' -e 's,"$,,') perhaps a single "sed" invocation suffices? sed -n -e '/^#include/{ s/#include ["<]\(.*\)".*/\1/p

[PATCH 1/2] check-headers: add header usage checks for .c files

2014-09-14 Thread David Aguilar
Teach check-header.sh to ensure that the first included header in .c files is either git-compat-util.h, builtin.h, or cache.h. Ensure that common-cmds.h is only included by help.c. Move the logic into functions so that we can skip parts of the check. Signed-off-by: David Aguilar --- This depend