git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/2] Reduce parse-options.o dependencies

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2011, 23:35 UTC
Message-ID
<7vr54ro72x.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110811110441.GD5012@elie.gateway.2wire.net>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 13 quoted lines
>> diff --git a/parse-options-cb.c b/parse-options-cb.c
>> new file mode 100644
>> index 0000000..c248f66
>> --- /dev/null
>> +++ b/parse-options-cb.c
>> @@ -0,0 +1,125 @@
>> +#include "git-compat-util.h"
>> +#include "parse-options.h"
>> +#include "cache.h"
>
> Style: Files in git tend to use only one of "git-compat-util.h",
> "cache.h", or "builtin.h" and put it at the top.  So in this case, it
> should probably use just "cache.h".
This needs a bit of clarification.

The compatibility rule actually is to have git-compat-util.h at the very beginning. As cache.h is a very widely used header almost everybody that needs to access the internals include, it includes git-compat-util.h as its first thing to include.

So if this is an old file that existed before git-compat-util.h, then it is perfectly fine to start it with

	#include "cache.h"
        #include "parse-options.h"
Otherwise the three-line include above is also just fine.
Previous: Jonathan Nieder
Message 6 of 6 in “Reduce parse-options.o dependencies”
  1. 0/2 Reduce parse-options.o dependenciesDmitry Ivankov, Aug 11, 2011
  2. 1/2 parse-options: export opterr, optbugDmitry Ivankov, Aug 11, 2011
  3. Jonathan NiederAug 11, 2011
  4. 2/2 Reduce parse-options.o dependenciesDmitry Ivankov, Aug 11, 2011
  5. Jonathan NiederAug 11, 2011
  6. Junio C HamanoAug 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.