Re: [PATCH] builtin: use builtin.h for all builtin/ commands
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:27
Ævar Arnfjörð Bjarmason [off-list ref] 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.
quoted hunk
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.