Message ID | 1c6989ae456c86850761b079384f1505735e317a.1681614206.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Header cleanups (more splitting of cache.h and simplifying a few other deps) | expand |
On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote: > From: Elijah Newren <newren@gmail.com> > > Previously, hash.h depended upon and included repository.h, due to > the definition and use of the_hash_algo (defined as > the_repository->hash_algo). Move this #define, and the associated > inline functions that depend upon it, from hash.h to repository.h. > Due to that movement, reverse the dependencies so repository.h includes > hash.h. > > This allows hash.h and object.h to be fairly small, minimal headers. It > also exposes a lot of hidden dependencies on both path.h (which was > brought in by repository.h) and repository.h (which was previously > implicitly brought in by object.h). This is the first patch in the series where I don't immediately agree with the patch. This is a big list of methods that don't seem like they fit in repository.h: > diff --git a/repository.h b/repository.h > +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) > +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) > +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) > +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) > +static inline int is_null_oid(const struct object_id *oid) > +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) > +static inline void oidcpy_with_padding(struct object_id *dst, > + const struct object_id *src) > +static inline void hashclr(unsigned char *hash) > +static inline void oidclr(struct object_id *oid) > +static inline void oidread(struct object_id *oid, const unsigned char *hash) > +static inline int is_empty_blob_sha1(const unsigned char *sha1) > +static inline int is_empty_blob_oid(const struct object_id *oid) > +static inline int is_empty_tree_sha1(const unsigned char *sha1) > +static inline int is_empty_tree_oid(const struct object_id *oid) The goal to remove repository.h from hash.h and object.h makes sense as a goal, but is there another way to do it? Can we redefine 'extern struct repository *the_repository;' in hash.h so we have access to that pointer? Thanks, -Stolee
On Mon, Apr 17, 2023 at 1:59 PM Derrick Stolee <derrickstolee@github.com> wrote: > > On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote: > > From: Elijah Newren <newren@gmail.com> > > > > Previously, hash.h depended upon and included repository.h, due to > > the definition and use of the_hash_algo (defined as > > the_repository->hash_algo). Move this #define, and the associated > > inline functions that depend upon it, from hash.h to repository.h. > > Due to that movement, reverse the dependencies so repository.h includes > > hash.h. > > > > This allows hash.h and object.h to be fairly small, minimal headers. It > > also exposes a lot of hidden dependencies on both path.h (which was > > brought in by repository.h) and repository.h (which was previously > > implicitly brought in by object.h). > > This is the first patch in the series where I don't immediately agree > with the patch. This is a big list of methods that don't seem like > they fit in repository.h: > > > diff --git a/repository.h b/repository.h > > +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) > > +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) > > +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) > > +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) > > +static inline int is_null_oid(const struct object_id *oid) > > +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) > > +static inline void oidcpy_with_padding(struct object_id *dst, > > + const struct object_id *src) > > +static inline void hashclr(unsigned char *hash) > > +static inline void oidclr(struct object_id *oid) > > +static inline void oidread(struct object_id *oid, const unsigned char *hash) > > +static inline int is_empty_blob_sha1(const unsigned char *sha1) > > +static inline int is_empty_blob_oid(const struct object_id *oid) > > +static inline int is_empty_tree_sha1(const unsigned char *sha1) > > +static inline int is_empty_tree_oid(const struct object_id *oid) Yeah, their names suggest they in no way depend upon internals of a repository, but that's largely because they are misnamed, similar to our old friends like get_oid() and repo_get_oid(). > The goal to remove repository.h from hash.h and object.h makes sense > as a goal, but is there another way to do it? Can we redefine > 'extern struct repository *the_repository;' in hash.h so we have > access to that pointer? Having access to the pointer is insufficient. These functions all make use of the_repository->hash_algo, and are inline, so the definition and layout of struct repository is necessary. An alternate solution might be to just wrap the #define of the_hash_algo, as well as these functions, with NO_THE_REPOSITORY_COMPATIBILITY_MACROS, try to convince Ævar that we put those #ifdefs in before he wrote his series[1] and that he thus missed some uses of that macro, and then watch him transform all of them with a series of cocci changes so these functions just go away. ;-) But that sounds like a separate big series, and I'm dubious about my ability to hoodwink Ævar. Any other ideas? [1] https://lore.kernel.org/git/cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com/
Derrick Stolee <derrickstolee@github.com> writes: > This is the first patch in the series where I don't immediately agree > with the patch. This is a big list of methods that don't seem like > they fit in repository.h: > >> diff --git a/repository.h b/repository.h >> +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) >> +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) >> +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) >> +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) >> +static inline int is_null_oid(const struct object_id *oid) >> +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) >> +static inline void oidcpy_with_padding(struct object_id *dst, >> + const struct object_id *src) >> +static inline void hashclr(unsigned char *hash) >> +static inline void oidclr(struct object_id *oid) >> +static inline void oidread(struct object_id *oid, const unsigned char *hash) >> +static inline int is_empty_blob_sha1(const unsigned char *sha1) >> +static inline int is_empty_blob_oid(const struct object_id *oid) >> +static inline int is_empty_tree_sha1(const unsigned char *sha1) >> +static inline int is_empty_tree_oid(const struct object_id *oid) > > The goal to remove repository.h from hash.h and object.h makes sense > as a goal, but is there another way to do it? Indeed. All of the above sit very well in hash simply because they are all about hashes. It does not have much to do with "repository", not more than "well, hashes we use to identify objects, and objects are stored in repositories". From the point of view of somebody who needs to use these macros, it is utterly unnatural that they have to include "repository.h" (as opposed to, say, "hash.h") just to be able to compare two hash values. Most of our programs interact with only one repository, and it is understandable to include a header "repository.h" if your program needs to interact with an extra repository other than the "current" one. But this feels backwards and not quite satisfactory, even though inlines are special and I can fully sympathize with the author who felt that this patch was necessary.
On Tue, Apr 18, 2023 at 4:29 PM Junio C Hamano <gitster@pobox.com> wrote: > > Derrick Stolee <derrickstolee@github.com> writes: > > > This is the first patch in the series where I don't immediately agree > > with the patch. This is a big list of methods that don't seem like > > they fit in repository.h: > > > >> diff --git a/repository.h b/repository.h > >> +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) > >> +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) > >> +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) > >> +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) > >> +static inline int is_null_oid(const struct object_id *oid) > >> +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) > >> +static inline void oidcpy_with_padding(struct object_id *dst, > >> + const struct object_id *src) > >> +static inline void hashclr(unsigned char *hash) > >> +static inline void oidclr(struct object_id *oid) > >> +static inline void oidread(struct object_id *oid, const unsigned char *hash) > >> +static inline int is_empty_blob_sha1(const unsigned char *sha1) > >> +static inline int is_empty_blob_oid(const struct object_id *oid) > >> +static inline int is_empty_tree_sha1(const unsigned char *sha1) > >> +static inline int is_empty_tree_oid(const struct object_id *oid) > > > > The goal to remove repository.h from hash.h and object.h makes sense > > as a goal, but is there another way to do it? > > Indeed. > > All of the above sit very well in hash simply because they are all > about hashes. It does not have much to do with "repository", not > more than "well, hashes we use to identify objects, and objects are > stored in repositories". > > From the point of view of somebody who needs to use these macros, it > is utterly unnatural that they have to include "repository.h" (as > opposed to, say, "hash.h") just to be able to compare two hash > values. Most of our programs interact with only one repository, and > it is understandable to include a header "repository.h" if your > program needs to interact with an extra repository other than the > "current" one. But this feels backwards and not quite satisfactory, > even though inlines are special and I can fully sympathize with the > author who felt that this patch was necessary. What would you think of either of the two following alternative solutions: * Move these into a new header, say "hash-repository.h" that folks could include. People wanting to use these macros would have to include an alternate header, but one that is perhaps more logically named, and would allow other headers to get the basics of hash.h without repository.h * Move everything else in hash.h to a new header, say "hash-basics.h", which hash.h will #include. That retains the ability for people to depend on hash.h and use these inline functions, while also giving other headers the option of including the basics of today's hash.h without repository.h.
On 4/20/2023 1:06 AM, Elijah Newren wrote: > What would you think of either of the two following alternative solutions: > > * Move these into a new header, say "hash-repository.h" that folks > could include. People wanting to use these macros would have to > include an alternate header, but one that is perhaps more logically > named, and would allow other headers to get the basics of hash.h > without repository.h > > * Move everything else in hash.h to a new header, say > "hash-basics.h", which hash.h will #include. That retains the ability > for people to depend on hash.h and use these inline functions, while > also giving other headers the option of including the basics of > today's hash.h without repository.h. I like both of these options, but prefer the second one. This is mostly because most consumers in the Git codebase will want these methods, and only the most fundamental hashing code will care about hashing separate from the_hash_algo. So, the most-natural name for "the header file that lets me hash stuff" would be "hash.h" and "hash-basics.h" is for "I'm doing very simple, low-level hashing". Thanks, -Stolee
Derrick Stolee <derrickstolee@github.com> writes: > This is mostly because most consumers in the Git codebase will want > these methods, and only the most fundamental hashing code will care > about hashing separate from the_hash_algo. So, the most-natural name > for "the header file that lets me hash stuff" would be "hash.h" and > "hash-basics.h" is for "I'm doing very simple, low-level hashing". I do agree with the reasoning for "most people want 'hash.h'"; what is called the "basics" sounds more like for advanced users of the low-level machinery, but somehow I expect "basic" would the one to be used in sample programs in tutorials or something. "ll-hash.h" for low-level hash features? I dunno. But whatever the name for the header file meant to be used by "advanced callers to low-level machinery" would be, I like your choice of the latter variant between the ones Elijah presented. Thanks.
Junio C Hamano <gitster@pobox.com> writes: > Derrick Stolee <derrickstolee@github.com> writes: > >> This is mostly because most consumers in the Git codebase will want >> these methods, and only the most fundamental hashing code will care >> about hashing separate from the_hash_algo. So, the most-natural name >> for "the header file that lets me hash stuff" would be "hash.h" and >> "hash-basics.h" is for "I'm doing very simple, low-level hashing". > > I do agree with the reasoning for "most people want 'hash.h'"; what > is called the "basics" sounds more like for advanced users of the > low-level machinery, but somehow I expect "basic" would the one to > be used in sample programs in tutorials or something. "ll-hash.h" > for low-level hash features? I dunno. > > But whatever the name for the header file meant to be used by > "advanced callers to low-level machinery" would be, I like your > choice of the latter variant between the ones Elijah presented. FWIW, I also think this is a good idea. I suspect that a lot of the libification effort will need a similar distinction between "a subsystem supporting the needs of the git binary" (aka high-level) and "basic, reusable functionality that can be its own library" (aka low-level).
diff --git a/alloc.c b/alloc.c index 2886aa93543..377e80f5dda 100644 --- a/alloc.c +++ b/alloc.c @@ -13,6 +13,7 @@ #include "blob.h" #include "tree.h" #include "commit.h" +#include "repository.h" #include "tag.h" #include "alloc.h" diff --git a/branch.c b/branch.c index 7df982693af..9415ee3f340 100644 --- a/branch.c +++ b/branch.c @@ -9,6 +9,7 @@ #include "refs.h" #include "refspec.h" #include "remote.h" +#include "repository.h" #include "sequencer.h" #include "commit.h" #include "worktree.h" diff --git a/builtin/apply.c b/builtin/apply.c index fe72c0ec3eb..e3ff02a09e3 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -2,6 +2,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "apply.h" static const char * const apply_usage[] = { diff --git a/builtin/archive.c b/builtin/archive.c index d13934f1a80..b0eaa3c14a3 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -9,6 +9,7 @@ #include "transport.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "sideband.h" static void create_output_file(const char *output_file) diff --git a/builtin/bundle.c b/builtin/bundle.c index 584d905d965..44113389d7a 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -5,6 +5,7 @@ #include "strvec.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "cache.h" #include "bundle.h" diff --git a/builtin/check-attr.c b/builtin/check-attr.c index 037bf1aaa2a..b2b678847f5 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -7,6 +7,7 @@ #include "gettext.h" #include "object-name.h" #include "quote.h" +#include "repository.h" #include "setup.h" #include "parse-options.h" #include "write-or-die.h" diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 9401dad0070..e4b78782a32 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -7,6 +7,7 @@ #include "quote.h" #include "pathspec.h" #include "parse-options.h" +#include "repository.h" #include "submodule.h" #include "write-or-die.h" diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 7df673e3e70..9375a05539f 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -11,6 +11,7 @@ #include "gettext.h" #include "lockfile.h" #include "quote.h" +#include "repository.h" #include "cache-tree.h" #include "parse-options.h" #include "entry.h" diff --git a/builtin/clean.c b/builtin/clean.c index 14c0d555eac..78852d28cec 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -14,6 +14,7 @@ #include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "string-list.h" #include "quote.h" diff --git a/builtin/config.c b/builtin/config.c index 9401f1e5e3b..7efcf2d2159 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -10,6 +10,7 @@ #include "parse-options.h" #include "urlmatch.h" #include "quote.h" +#include "repository.h" #include "setup.h" #include "worktree.h" #include "wrapper.h" diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 508da4c6e4d..204e78ac772 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "wrapper.h" #include "write-or-die.h" diff --git a/builtin/credential-store.c b/builtin/credential-store.c index 8977604eb9d..30c6ccf56c0 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "lockfile.h" #include "credential.h" +#include "path.h" #include "string-list.h" #include "parse-options.h" #include "write-or-die.h" diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index 27425c2fc9e..c28b0b3543a 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -3,6 +3,8 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "path.h" +#include "repository.h" #include "run-command.h" #include "string-list.h" diff --git a/builtin/help.c b/builtin/help.c index 128aa83099a..d3cf4af3f6e 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -8,6 +8,7 @@ #include "gettext.h" #include "pager.h" #include "parse-options.h" +#include "path.h" #include "run-command.h" #include "config-list.h" #include "help.h" diff --git a/builtin/init-db.c b/builtin/init-db.c index cda6ee75eb5..aef40361052 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -14,6 +14,7 @@ #include "exec-cmd.h" #include "object-file.h" #include "parse-options.h" +#include "path.h" #include "setup.h" #include "worktree.h" #include "wrapper.h" diff --git a/builtin/merge-index.c b/builtin/merge-index.c index c875f5d37ee..f044382ed8f 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "hex.h" +#include "repository.h" #include "run-command.h" static const char *pgm; diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index fa1035405c3..eae25c9486e 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -6,6 +6,7 @@ #include "tag.h" #include "merge-recursive.h" #include "object-name.h" +#include "repository.h" #include "xdiff-interface.h" static const char builtin_merge_recursive_usage[] = diff --git a/builtin/mv.c b/builtin/mv.c index 32935af48e6..665bd274485 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -18,6 +18,7 @@ #include "cache-tree.h" #include "string-list.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "submodule.h" #include "entry.h" diff --git a/builtin/push.c b/builtin/push.c index 7d2b0505aac..4e5780dd50d 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -15,6 +15,7 @@ #include "transport.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "submodule.h" #include "submodule-config.h" #include "send-pack.h" diff --git a/builtin/read-tree.c b/builtin/read-tree.c index d61cbad96de..440f19b1b87 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -19,6 +19,7 @@ #include "dir.h" #include "builtin.h" #include "parse-options.h" +#include "repository.h" #include "resolve-undo.h" #include "setup.h" #include "submodule.h" diff --git a/builtin/rerere.c b/builtin/rerere.c index d4a03707b1a..d4bd52797f4 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -4,6 +4,7 @@ #include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "string-list.h" #include "rerere.h" #include "wrapper.h" diff --git a/builtin/rm.c b/builtin/rm.c index d36072252e7..ccbce94d07d 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -15,6 +15,7 @@ #include "tree-walk.h" #include "object-name.h" #include "parse-options.h" +#include "repository.h" #include "string-list.h" #include "setup.h" #include "submodule.h" diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 20030b75e39..04167b14060 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -10,6 +10,7 @@ #include "strvec.h" #include "object-name.h" #include "parse-options.h" +#include "repository.h" #include "dir.h" #include "commit-slab.h" #include "date.h" diff --git a/builtin/show-index.c b/builtin/show-index.c index d4bbbbcd6ce..6608b5d252e 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -4,6 +4,7 @@ #include "hex.h" #include "pack.h" #include "parse-options.h" +#include "repository.h" static const char *const show_index_usage[] = { "git show-index [--object-format=<hash-algorithm>]", diff --git a/builtin/update-index.c b/builtin/update-index.c index 58bbc80db77..df36bc0a42d 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -21,6 +21,7 @@ #include "parse-options.h" #include "pathspec.h" #include "dir.h" +#include "repository.h" #include "setup.h" #include "split-index.h" #include "symlinks.h" diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 6ca85420c3b..ef1fcb86718 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -6,6 +6,7 @@ #include "object-name.h" #include "parse-options.h" #include "quote.h" +#include "repository.h" #include "strvec.h" static const char * const git_update_ref_usage[] = { diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 945ee2b4126..5be97ca1af5 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -6,6 +6,7 @@ #include "archive.h" #include "pkt-line.h" #include "sideband.h" +#include "repository.h" #include "run-command.h" #include "strvec.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 0b411e9deee..5d3ca819e76 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -14,6 +14,7 @@ #include "strvec.h" #include "branch.h" #include "refs.h" +#include "repository.h" #include "run-command.h" #include "hook.h" #include "sigchain.h" diff --git a/checkout.c b/checkout.c index 04238b27133..4256e71a7c4 100644 --- a/checkout.c +++ b/checkout.c @@ -2,6 +2,7 @@ #include "object-name.h" #include "remote.h" #include "refspec.h" +#include "repository.h" #include "checkout.h" #include "config.h" #include "strbuf.h" diff --git a/chunk-format.c b/chunk-format.c index 60a73c1b140..6bd87b7de89 100644 --- a/chunk-format.c +++ b/chunk-format.c @@ -3,6 +3,7 @@ #include "chunk-format.h" #include "csum-file.h" #include "gettext.h" +#include "repository.h" #include "trace2.h" /* diff --git a/common-main.c b/common-main.c index 601a875e2fb..8ab50fa37a4 100644 --- a/common-main.c +++ b/common-main.c @@ -2,6 +2,7 @@ #include "exec-cmd.h" #include "gettext.h" #include "attr.h" +#include "repository.h" #include "setup.h" #include "strbuf.h" #include "trace2.h" diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index eb25123fa12..e62f093cc19 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "hex.h" +#include "repository.h" #include "strbuf.h" #include "fsmonitor.h" #include "fsmonitor-ipc.h" diff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c index c9536dfb666..8928fa93ce2 100644 --- a/compat/fsmonitor/fsm-ipc-win32.c +++ b/compat/fsmonitor/fsm-ipc-win32.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "fsmonitor-ipc.h" +#include "path.h" const char *fsmonitor_ipc__get_path(struct repository *r) { static char *ret; diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c index 8a9881db077..a4d11376ba5 100644 --- a/compat/precompose_utf8.c +++ b/compat/precompose_utf8.c @@ -9,6 +9,7 @@ #include "config.h" #include "environment.h" #include "gettext.h" +#include "path.h" #include "utf8.h" #include "precompose_utf8.h" diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c index e3e895c78a2..a4e33768f43 100644 --- a/compat/win32/trace2_win32_process_info.c +++ b/compat/win32/trace2_win32_process_info.c @@ -1,5 +1,6 @@ #include "../../cache.h" #include "../../json-writer.h" +#include "../../repository.h" #include "../../trace2.h" #include "lazyload.h" #include <Psapi.h> diff --git a/copy.c b/copy.c index db6b615c188..923d8a6dc61 100644 --- a/copy.c +++ b/copy.c @@ -1,5 +1,6 @@ #include "cache.h" #include "copy.h" +#include "path.h" #include "wrapper.h" int copy_fd(int ifd, int ofd) diff --git a/csum-file.c b/csum-file.c index 82ae2973d30..2d14b76c533 100644 --- a/csum-file.c +++ b/csum-file.c @@ -10,6 +10,7 @@ #include "git-compat-util.h" #include "progress.h" #include "csum-file.h" +#include "repository.h" #include "wrapper.h" static void verify_buffer_or_die(struct hashfile *f, diff --git a/daemon.c b/daemon.c index 75c3c064574..f89f99d7ef4 100644 --- a/daemon.c +++ b/daemon.c @@ -3,6 +3,7 @@ #include "alloc.h" #include "config.h" #include "environment.h" +#include "path.h" #include "pkt-line.h" #include "protocol.h" #include "run-command.h" diff --git a/editor.c b/editor.c index b34e10606d2..38c5dbbb79b 100644 --- a/editor.c +++ b/editor.c @@ -6,6 +6,7 @@ #include "environment.h" #include "gettext.h" #include "pager.h" +#include "path.h" #include "strbuf.h" #include "strvec.h" #include "run-command.h" diff --git a/exec-cmd.c b/exec-cmd.c index 6f618463896..1e34e48c0e4 100644 --- a/exec-cmd.c +++ b/exec-cmd.c @@ -3,6 +3,7 @@ #include "environment.h" #include "exec-cmd.h" #include "gettext.h" +#include "path.h" #include "quote.h" #include "strvec.h" #include "trace.h" diff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c index 866828e2992..6a6a89764a6 100644 --- a/fsmonitor-ipc.c +++ b/fsmonitor-ipc.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "simple-ipc.h" #include "fsmonitor-ipc.h" +#include "repository.h" #include "run-command.h" #include "strbuf.h" #include "trace2.h" diff --git a/gpg-interface.c b/gpg-interface.c index aceeb083367..8615dcd4b4b 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -7,6 +7,7 @@ #include "dir.h" #include "ident.h" #include "gpg-interface.h" +#include "path.h" #include "sigchain.h" #include "tempfile.h" #include "alias.h" diff --git a/hash-lookup.c b/hash-lookup.c index b98ed5e11e8..68cf6d03bf3 100644 --- a/hash-lookup.c +++ b/hash-lookup.c @@ -1,5 +1,6 @@ #include "cache.h" #include "hash-lookup.h" +#include "repository.h" static uint32_t take2(const struct object_id *oid, size_t ofs) { diff --git a/hash.h b/hash.h index d39f73618cb..ed963816289 100644 --- a/hash.h +++ b/hash.h @@ -1,8 +1,6 @@ #ifndef HASH_H #define HASH_H -#include "repository.h" - #if defined(SHA1_APPLE) #include <CommonCrypto/CommonDigest.h> #elif defined(SHA1_OPENSSL) @@ -230,8 +228,6 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p) return p - hash_algos; } -#define the_hash_algo the_repository->hash_algo - const struct object_id *null_oid(void); static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) @@ -245,21 +241,6 @@ static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char * return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); } -static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) -{ - return hashcmp_algop(sha1, sha2, the_hash_algo); -} - -static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) -{ - const struct git_hash_algo *algop; - if (!oid1->algo) - algop = the_hash_algo; - else - algop = &hash_algos[oid1->algo]; - return hashcmp_algop(oid1->hash, oid2->hash, algop); -} - static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) { /* @@ -271,53 +252,12 @@ static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *s return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ); } -static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) -{ - return hasheq_algop(sha1, sha2, the_hash_algo); -} - -static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) -{ - const struct git_hash_algo *algop; - if (!oid1->algo) - algop = the_hash_algo; - else - algop = &hash_algos[oid1->algo]; - return hasheq_algop(oid1->hash, oid2->hash, algop); -} - -static inline int is_null_oid(const struct object_id *oid) -{ - return oideq(oid, null_oid()); -} - -static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) -{ - memcpy(sha_dst, sha_src, the_hash_algo->rawsz); -} - static inline void oidcpy(struct object_id *dst, const struct object_id *src) { memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ); dst->algo = src->algo; } -/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ -static inline void oidcpy_with_padding(struct object_id *dst, - const struct object_id *src) -{ - size_t hashsz; - - if (!src->algo) - hashsz = the_hash_algo->rawsz; - else - hashsz = hash_algos[src->algo].rawsz; - - memcpy(dst->hash, src->hash, hashsz); - memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); - dst->algo = src->algo; -} - static inline struct object_id *oiddup(const struct object_id *src) { struct object_id *dst = xmalloc(sizeof(struct object_id)); @@ -325,43 +265,6 @@ static inline struct object_id *oiddup(const struct object_id *src) return dst; } -static inline void hashclr(unsigned char *hash) -{ - memset(hash, 0, the_hash_algo->rawsz); -} - -static inline void oidclr(struct object_id *oid) -{ - memset(oid->hash, 0, GIT_MAX_RAWSZ); - oid->algo = hash_algo_by_ptr(the_hash_algo); -} - -static inline void oidread(struct object_id *oid, const unsigned char *hash) -{ - memcpy(oid->hash, hash, the_hash_algo->rawsz); - oid->algo = hash_algo_by_ptr(the_hash_algo); -} - -static inline int is_empty_blob_sha1(const unsigned char *sha1) -{ - return hasheq(sha1, the_hash_algo->empty_blob->hash); -} - -static inline int is_empty_blob_oid(const struct object_id *oid) -{ - return oideq(oid, the_hash_algo->empty_blob); -} - -static inline int is_empty_tree_sha1(const unsigned char *sha1) -{ - return hasheq(sha1, the_hash_algo->empty_tree->hash); -} - -static inline int is_empty_tree_oid(const struct object_id *oid) -{ - return oideq(oid, the_hash_algo->empty_tree); -} - static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) { oid->algo = hash_algo_by_ptr(algop); diff --git a/hex.c b/hex.c index 0a1bddc1284..f6849b51b28 100644 --- a/hex.c +++ b/hex.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "hex.h" +#include "repository.h" const signed char hexval_table[256] = { -1, -1, -1, -1, -1, -1, -1, -1, /* 00-07 */ diff --git a/hook.c b/hook.c index 76e322f5804..3ca5e60895d 100644 --- a/hook.c +++ b/hook.c @@ -2,6 +2,7 @@ #include "advice.h" #include "gettext.h" #include "hook.h" +#include "path.h" #include "run-command.h" #include "config.h" #include "strbuf.h" diff --git a/khash.h b/khash.h index 85362718c56..edd5b45d000 100644 --- a/khash.h +++ b/khash.h @@ -27,6 +27,7 @@ #define __AC_KHASH_H #include "hashmap.h" +#include "repository.h" #define AC_VERSION_KHASH_H "0.2.8" diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index c00dfbab1cd..2d1e8aa7ee7 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -2,6 +2,7 @@ #include "gettext.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" +#include "repository.h" #include "commit.h" diff --git a/negotiator/default.c b/negotiator/default.c index f4b78eb47dd..5cb2b1d2046 100644 --- a/negotiator/default.c +++ b/negotiator/default.c @@ -4,6 +4,7 @@ #include "../fetch-negotiator.h" #include "../prio-queue.h" #include "../refs.h" +#include "../repository.h" #include "../tag.h" /* Remember to update object flag allocation in object.h */ diff --git a/negotiator/skipping.c b/negotiator/skipping.c index c7d6ab39bc5..97e7e1ae725 100644 --- a/negotiator/skipping.c +++ b/negotiator/skipping.c @@ -5,6 +5,7 @@ #include "../hex.h" #include "../prio-queue.h" #include "../refs.h" +#include "../repository.h" #include "../tag.h" /* Remember to update object flag allocation in object.h */ diff --git a/object-file.h b/object-file.h index e0cfc3a5db8..d6414610f80 100644 --- a/object-file.h +++ b/object-file.h @@ -4,6 +4,8 @@ #include "git-zlib.h" #include "object.h" +struct index_state; + /* * Set this to 0 to prevent oid_object_info_extended() from fetching missing * blobs. This has a difference only if extensions.partialClone is set. diff --git a/object.h b/object.h index 96e52e24fb1..6cd8b49fa66 100644 --- a/object.h +++ b/object.h @@ -4,6 +4,7 @@ #include "hash.h" struct buffer_slab; +struct repository; struct parsed_object_pool { struct object **obj_hash; diff --git a/oid-array.h b/oid-array.h index f60f9af6741..8bfe452259b 100644 --- a/oid-array.h +++ b/oid-array.h @@ -2,6 +2,7 @@ #define OID_ARRAY_H #include "hash.h" +#include "repository.h" /** * The API provides storage and manipulation of sets of object identifiers. diff --git a/oidmap.c b/oidmap.c index 8c1a139c974..d268486f4e8 100644 --- a/oidmap.c +++ b/oidmap.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "oidmap.h" +#include "repository.h" static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED, const struct hashmap_entry *e1, diff --git a/oidtree.c b/oidtree.c index 7d57b7b19e3..634214673dd 100644 --- a/oidtree.c +++ b/oidtree.c @@ -6,6 +6,7 @@ #include "oidtree.h" #include "alloc.h" #include "hash.h" +#include "repository.h" struct oidtree_iter_data { oidtree_iter fn; diff --git a/parallel-checkout.c b/parallel-checkout.c index 7f0569cc930..78cb6e3003a 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -7,6 +7,7 @@ #include "parallel-checkout.h" #include "pkt-line.h" #include "progress.h" +#include "repository.h" #include "run-command.h" #include "sigchain.h" #include "streaming.h" diff --git a/pathspec.c b/pathspec.c index ec335a214e2..1e57b6c667d 100644 --- a/pathspec.c +++ b/pathspec.c @@ -6,6 +6,7 @@ #include "gettext.h" #include "pathspec.h" #include "attr.h" +#include "repository.h" #include "setup.h" #include "strvec.h" #include "symlinks.h" diff --git a/progress.c b/progress.c index 72d5e0c73c1..f695798acac 100644 --- a/progress.c +++ b/progress.c @@ -12,6 +12,7 @@ #include "git-compat-util.h" #include "pager.h" #include "progress.h" +#include "repository.h" #include "strbuf.h" #include "trace.h" #include "trace2.h" diff --git a/rebase-interactive.c b/rebase-interactive.c index 789f4073617..852a3313182 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -5,6 +5,7 @@ #include "gettext.h" #include "sequencer.h" #include "rebase-interactive.h" +#include "repository.h" #include "strbuf.h" #include "commit-slab.h" #include "config.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index 1128a9af292..212a0c14ea4 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -14,6 +14,7 @@ #include "../lockfile.h" #include "../object.h" #include "../object-file.h" +#include "../repository.h" #include "../dir.h" #include "../chdir-notify.h" #include "../setup.h" diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 2333ed5a1f7..b3a46f9d4dd 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -9,6 +9,7 @@ #include "../iterator.h" #include "../lockfile.h" #include "../chdir-notify.h" +#include "../repository.h" #include "../wrapper.h" #include "../write-or-die.h" diff --git a/refs/ref-cache.c b/refs/ref-cache.c index dc1ca49c85f..84c3838c743 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -4,6 +4,7 @@ #include "refs-internal.h" #include "ref-cache.h" #include "../iterator.h" +#include "../repository.h" void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry) { diff --git a/refs/ref-cache.h b/refs/ref-cache.h index cf4ad9070b9..31ebe24f6cf 100644 --- a/refs/ref-cache.h +++ b/refs/ref-cache.h @@ -5,6 +5,7 @@ struct ref_dir; struct ref_store; +struct repository; /* * If this ref_cache is filled lazily, this function is used to load diff --git a/refspec.c b/refspec.c index 7b5c305514d..68020ee84c6 100644 --- a/refspec.c +++ b/refspec.c @@ -5,6 +5,7 @@ #include "strvec.h" #include "refs.h" #include "refspec.h" +#include "repository.h" static struct refspec_item s_tag_refspec = { .force = 0, diff --git a/repository.h b/repository.h index 15a8afc5fb5..9e36868207f 100644 --- a/repository.h +++ b/repository.h @@ -1,6 +1,7 @@ #ifndef REPOSITORY_H #define REPOSITORY_H +#include "hash.h" #include "path.h" struct config_set; @@ -238,4 +239,99 @@ void prepare_repo_settings(struct repository *r); */ int upgrade_repository_format(int target_version); +#define the_hash_algo the_repository->hash_algo + +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) +{ + return hashcmp_algop(sha1, sha2, the_hash_algo); +} + +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) +{ + const struct git_hash_algo *algop; + if (!oid1->algo) + algop = the_hash_algo; + else + algop = &hash_algos[oid1->algo]; + return hashcmp_algop(oid1->hash, oid2->hash, algop); +} + +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) +{ + return hasheq_algop(sha1, sha2, the_hash_algo); +} + +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) +{ + const struct git_hash_algo *algop; + if (!oid1->algo) + algop = the_hash_algo; + else + algop = &hash_algos[oid1->algo]; + return hasheq_algop(oid1->hash, oid2->hash, algop); +} + +static inline int is_null_oid(const struct object_id *oid) +{ + return oideq(oid, null_oid()); +} + +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) +{ + memcpy(sha_dst, sha_src, the_hash_algo->rawsz); +} + +/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ +static inline void oidcpy_with_padding(struct object_id *dst, + const struct object_id *src) +{ + size_t hashsz; + + if (!src->algo) + hashsz = the_hash_algo->rawsz; + else + hashsz = hash_algos[src->algo].rawsz; + + memcpy(dst->hash, src->hash, hashsz); + memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); + dst->algo = src->algo; +} + +static inline void hashclr(unsigned char *hash) +{ + memset(hash, 0, the_hash_algo->rawsz); +} + +static inline void oidclr(struct object_id *oid) +{ + memset(oid->hash, 0, GIT_MAX_RAWSZ); + oid->algo = hash_algo_by_ptr(the_hash_algo); +} + +static inline void oidread(struct object_id *oid, const unsigned char *hash) +{ + memcpy(oid->hash, hash, the_hash_algo->rawsz); + oid->algo = hash_algo_by_ptr(the_hash_algo); +} + +static inline int is_empty_blob_sha1(const unsigned char *sha1) +{ + return hasheq(sha1, the_hash_algo->empty_blob->hash); +} + +static inline int is_empty_blob_oid(const struct object_id *oid) +{ + return oideq(oid, the_hash_algo->empty_blob); +} + +static inline int is_empty_tree_sha1(const unsigned char *sha1) +{ + return hasheq(sha1, the_hash_algo->empty_tree->hash); +} + +static inline int is_empty_tree_oid(const struct object_id *oid) +{ + return oideq(oid, the_hash_algo->empty_tree); +} + #endif /* REPOSITORY_H */ diff --git a/resolve-undo.c b/resolve-undo.c index e81096e2d45..7dbd38a2cf9 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -1,6 +1,7 @@ #include "cache.h" #include "dir.h" #include "resolve-undo.h" +#include "repository.h" #include "string-list.h" /* The only error case is to run out of memory in string-list */ diff --git a/split-index.c b/split-index.c index 3fc4e91485a..bce6480084e 100644 --- a/split-index.c +++ b/split-index.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "gettext.h" #include "mem-pool.h" +#include "repository.h" #include "split-index.h" #include "strbuf.h" #include "ewah/ewok.h" diff --git a/strbuf.c b/strbuf.c index 729378ec824..08eec8f1d8b 100644 --- a/strbuf.c +++ b/strbuf.c @@ -6,6 +6,7 @@ #include "hex.h" #include "object-name.h" #include "refs.h" +#include "repository.h" #include "string-list.h" #include "utf8.h" #include "date.h" diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index d2b30d644da..aabe31d724b 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -2,6 +2,7 @@ #include "bloom.h" #include "hex.h" #include "commit.h" +#include "repository.h" #include "setup.h" static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS; diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c index cdaf5046f5a..9507b356e22 100644 --- a/t/helper/test-cache-tree.c +++ b/t/helper/test-cache-tree.c @@ -6,6 +6,7 @@ #include "tree.h" #include "cache-tree.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" static char const * const test_cache_tree_usage[] = { diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c index 715aabfbae7..df30cc92d24 100644 --- a/t/helper/test-dump-cache-tree.c +++ b/t/helper/test-dump-cache-tree.c @@ -4,6 +4,7 @@ #include "hex.h" #include "tree.h" #include "cache-tree.h" +#include "repository.h" #include "setup.h" static void dump_one(struct cache_tree *it, const char *pfx, const char *x) diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c index 7e9de296db3..6dc49583375 100644 --- a/t/helper/test-dump-fsmonitor.c +++ b/t/helper/test-dump-fsmonitor.c @@ -1,5 +1,6 @@ #include "test-tool.h" #include "cache.h" +#include "repository.h" #include "setup.h" int cmd__dump_fsmonitor(int ac, const char **av) diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c index 415f55f31da..d1b99d21dcd 100644 --- a/t/helper/test-dump-untracked-cache.c +++ b/t/helper/test-dump-untracked-cache.c @@ -3,6 +3,7 @@ #include "cache.h" #include "dir.h" #include "hex.h" +#include "repository.h" #include "setup.h" static int compare_untracked(const void *a_, const void *b_) diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c index 7c7fc8efc13..43707486dd4 100644 --- a/t/helper/test-example-decorate.c +++ b/t/helper/test-example-decorate.c @@ -2,6 +2,7 @@ #include "git-compat-util.h" #include "object.h" #include "decorate.h" +#include "repository.h" int cmd__example_decorate(int argc, const char **argv) { diff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c index a37236cd0a6..bb00e1e5d14 100644 --- a/t/helper/test-fsmonitor-client.c +++ b/t/helper/test-fsmonitor-client.c @@ -7,6 +7,7 @@ #include "cache.h" #include "parse-options.h" #include "fsmonitor-ipc.h" +#include "repository.h" #include "setup.h" #include "thread-utils.h" #include "trace2.h" diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c index f23d983c118..b83a75d19f6 100644 --- a/t/helper/test-lazy-init-name-hash.c +++ b/t/helper/test-lazy-init-name-hash.c @@ -3,6 +3,7 @@ #include "cache.h" #include "environment.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "trace.h" diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c index a498fece7a3..3c62e33ccdf 100644 --- a/t/helper/test-match-trees.c +++ b/t/helper/test-match-trees.c @@ -3,6 +3,7 @@ #include "hex.h" #include "match-trees.h" #include "object-name.h" +#include "repository.h" #include "setup.h" #include "tree.h" diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c index de6ab77fdaa..bba4099f65f 100644 --- a/t/helper/test-oidmap.c +++ b/t/helper/test-oidmap.c @@ -2,6 +2,7 @@ #include "hex.h" #include "object-name.h" #include "oidmap.h" +#include "repository.h" #include "setup.h" #include "strbuf.h" diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c index 6355c9e4b6d..2ef53d5f7a2 100644 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@ -2,6 +2,7 @@ #include "cache.h" #include "abspath.h" #include "environment.h" +#include "path.h" #include "setup.h" #include "string-list.h" #include "trace.h" diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index a4c24d0e421..c1ae2763954 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "config.h" +#include "repository.h" #include "setup.h" #include "wrapper.h" diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c index 15b7688774c..444a4c02c8d 100644 --- a/t/helper/test-scrap-cache-tree.c +++ b/t/helper/test-scrap-cache-tree.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "repository.h" #include "setup.h" #include "tree.h" #include "cache-tree.h" diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c index c7c7fdbea98..8b1969ea48d 100644 --- a/t/helper/test-submodule-config.c +++ b/t/helper/test-submodule-config.c @@ -1,6 +1,7 @@ #include "test-tool.h" #include "config.h" #include "object-name.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" #include "submodule.h" diff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c index d31f5e48ab5..ecd40ded995 100644 --- a/t/helper/test-submodule-nested-repo-config.c +++ b/t/helper/test-submodule-nested-repo-config.c @@ -1,4 +1,5 @@ #include "test-tool.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" diff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c index 0e34581b209..cad8b0ca681 100644 --- a/t/helper/test-submodule.c +++ b/t/helper/test-submodule.c @@ -2,6 +2,7 @@ #include "test-tool-utils.h" #include "parse-options.h" #include "remote.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" #include "submodule.h" diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index a476df6c6cb..ab084d6034e 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -3,6 +3,7 @@ #include "run-command.h" #include "exec-cmd.h" #include "config.h" +#include "repository.h" #include "trace2.h" typedef int(fn_unit_test)(int argc, const char **argv); diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c index a93417ed3a9..eace08072d7 100644 --- a/t/helper/test-write-cache.c +++ b/t/helper/test-write-cache.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "repository.h" #include "setup.h" int cmd__write_cache(int argc, const char **argv) diff --git a/trace2.c b/trace2.c index 21264df71b7..0efc4e7b958 100644 --- a/trace2.c +++ b/trace2.c @@ -2,6 +2,7 @@ #include "config.h" #include "json-writer.h" #include "quote.h" +#include "repository.h" #include "run-command.h" #include "sigchain.h" #include "thread-utils.h" diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 9e7aab6d510..2af53e5d4de 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "json-writer.h" +#include "repository.h" #include "run-command.h" #include "version.h" #include "trace2/tr2_dst.h" diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c index 8672c2c2d04..1ebfb464d54 100644 --- a/trace2/tr2_tgt_normal.c +++ b/trace2/tr2_tgt_normal.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "repository.h" #include "run-command.h" #include "quote.h" #include "version.h" diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c index 3f2b2d53118..328e483a05e 100644 --- a/trace2/tr2_tgt_perf.c +++ b/trace2/tr2_tgt_perf.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "repository.h" #include "run-command.h" #include "quote.h" #include "version.h" diff --git a/tree-walk.h b/tree-walk.h index 25fe27e3529..1a3a1b8d4b1 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -4,6 +4,7 @@ #include "hash.h" struct index_state; +struct repository; #define MAX_TRAVERSE_TREES 8 diff --git a/tree.h b/tree.h index 6efff003e21..0499ad01aa7 100644 --- a/tree.h +++ b/tree.h @@ -3,6 +3,7 @@ #include "object.h" +struct pathspec; struct repository; struct strbuf; diff --git a/wrapper.c b/wrapper.c index e80f83498d8..5ab0460de5c 100644 --- a/wrapper.c +++ b/wrapper.c @@ -5,6 +5,7 @@ #include "abspath.h" #include "config.h" #include "gettext.h" +#include "repository.h" #include "strbuf.h" #include "trace2.h" #include "wrapper.h"