From: Junio C Hamano Date: Sun, 14 Sep 2014 05:23:03 GMT Subject: Re: [PATCH] help: ensure that common-cmds.h is only included by help.c Message-ID: In-Reply-To: <5414f6b2.XwoOyI03zlXiZ3ds%perryh@pluto.rain.com> On Sat, Sep 13, 2014 at 7:00 PM, Perry Hutchison wrote: > David Aguilar wrote: >> Add a #ifndef guard to ensure that common-cmds.h can only >> be included by help.c. > > This strikes me as a very peculiar, and sub-optimal, way of > achieving the purpose. If these definitions are intended to > be private to help.c, why not put them there and eliminate > common-cmds.h entirely? Have you studied where common-cmds.h comes from? After you have done so, would you make the same suggestion? Having said that, I also do not think this is such a good idea. Wouldn't the new "check" script added in this series a better place? For example, it may want to make sure that git-compat-util.h (or a couple of its equivalents) is the first file included in any mainline C source file, and such an inclusion is done unconditionally. Which would mean that the checker would scan *.c files with grep or a Perl script. It would be trivial to enforce "nobody other than these small selected C files is allowed to include common-cmds.h" rule. Regarding the other patch that butchers many *.h files, I am not still very enthused. Including cache.h at the beginning of branch.h, for example, would mean git-compat-util.h ends up included at the beginning of branch.h.