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

Re: [PATCH] builtin: use builtin.h for all builtin/ commands

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 1, 2010, 17:43 UTC
Message-ID
<7vmxs15phk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1283358207-3165-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Some builtin/*.c commands weren't using the builtin.h header, but
> instead manually imported headers like cache.h and commit.h which
> builtin.h would include for them.
Show 13 quoted lines
> diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
> index dbd8b7b..03abc30 100644
> --- a/builtin/fetch-pack.c
> +++ b/builtin/fetch-pack.c
> @@ -1,7 +1,6 @@
> -#include "cache.h"
> +#include "builtin.h"
>  #include "refs.h"
>  #include "pkt-line.h"
> -#include "commit.h"
>  #include "tag.h"
>  #include "exec_cmd.h"
>  #include "pack.h"

Leveraging the fact that builtin.h includes git-compat-util.h and cache.h is fine and I think strbuf is also generic and pervasive enough to be included in the mix, but in the longer term we would probably want to fix builtin.h not to include it itself does not need, notably commit.h and notes.h.

For example, the header currently defines notes related stuff, such as notes_rewrite_cfg parse_combine_notes_fn, etc. Shouldn't they belong to notes.h? And if we lose them, do we still need to include commit.h and notes.h in builtin.h?

And when that happens, the inclusion of commit.h needs to come back to this file, I think.

Previous: Ævar Arnfjörð Bjarmason
Message 5 of 5 in “Why isn't builtin.h used by all builtin/*.c files?”
  1. Ævar Arnfjörð BjarmasonSep 1, 2010
  2. Stephen BoydSep 1, 2010
  3. Junio C HamanoSep 1, 2010
  4. builtin: use builtin.h for all builtin/ commandsÆvar Arnfjörð Bjarmason, Sep 1, 2010
  5. Junio C HamanoSep 1, 2010

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.