Git fork

hash-ll.h: split out of hash.h to remove dependency on repository.h

hash.h depends upon and includes repository.h, due to the definition and
use of the_hash_algo (defined as the_repository->hash_algo). However,
most headers trying to include hash.h are only interested in the layout
of the structs like object_id. Move the parts of hash.h that do not
depend upon repository.h into a new file hash-ll.h (the "low level"
parts of hash.h), and adjust other files to use this new header where
the convenience inline functions aren't needed.

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), so also adjust other files to be
more explicit about what they depend upon.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Elijah Newren and committed by
Junio C Hamano
d1cbe1e6 23a517e4

+398 -292
+1
alloc.c
··· 13 13 #include "blob.h" 14 14 #include "tree.h" 15 15 #include "commit.h" 16 + #include "repository.h" 16 17 #include "tag.h" 17 18 #include "alloc.h" 18 19
+1 -1
apply.h
··· 1 1 #ifndef APPLY_H 2 2 #define APPLY_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 #include "lockfile.h" 6 6 #include "string-list.h" 7 7 #include "strmap.h"
+1
branch.c
··· 9 9 #include "refs.h" 10 10 #include "refspec.h" 11 11 #include "remote.h" 12 + #include "repository.h" 12 13 #include "sequencer.h" 13 14 #include "commit.h" 14 15 #include "worktree.h"
+1
builtin/apply.c
··· 2 2 #include "builtin.h" 3 3 #include "gettext.h" 4 4 #include "parse-options.h" 5 + #include "repository.h" 5 6 #include "apply.h" 6 7 7 8 static const char * const apply_usage[] = {
+1
builtin/archive.c
··· 9 9 #include "transport.h" 10 10 #include "parse-options.h" 11 11 #include "pkt-line.h" 12 + #include "repository.h" 12 13 #include "sideband.h" 13 14 14 15 static void create_output_file(const char *output_file)
+1
builtin/bundle.c
··· 5 5 #include "strvec.h" 6 6 #include "parse-options.h" 7 7 #include "pkt-line.h" 8 + #include "repository.h" 8 9 #include "cache.h" 9 10 #include "bundle.h" 10 11
+1
builtin/check-attr.c
··· 7 7 #include "gettext.h" 8 8 #include "object-name.h" 9 9 #include "quote.h" 10 + #include "repository.h" 10 11 #include "setup.h" 11 12 #include "parse-options.h" 12 13 #include "write-or-die.h"
+1
builtin/check-ignore.c
··· 7 7 #include "quote.h" 8 8 #include "pathspec.h" 9 9 #include "parse-options.h" 10 + #include "repository.h" 10 11 #include "submodule.h" 11 12 #include "write-or-die.h" 12 13
+1
builtin/checkout-index.c
··· 11 11 #include "gettext.h" 12 12 #include "lockfile.h" 13 13 #include "quote.h" 14 + #include "repository.h" 14 15 #include "cache-tree.h" 15 16 #include "parse-options.h" 16 17 #include "entry.h"
+1
builtin/clean.c
··· 14 14 #include "dir.h" 15 15 #include "gettext.h" 16 16 #include "parse-options.h" 17 + #include "repository.h" 17 18 #include "setup.h" 18 19 #include "string-list.h" 19 20 #include "quote.h"
+1
builtin/config.c
··· 9 9 #include "ident.h" 10 10 #include "parse-options.h" 11 11 #include "urlmatch.h" 12 + #include "path.h" 12 13 #include "quote.h" 13 14 #include "setup.h" 14 15 #include "worktree.h"
+1
builtin/credential-cache.c
··· 1 1 #include "builtin.h" 2 2 #include "gettext.h" 3 3 #include "parse-options.h" 4 + #include "path.h" 4 5 #include "wrapper.h" 5 6 #include "write-or-die.h" 6 7
+1
builtin/credential-store.c
··· 3 3 #include "gettext.h" 4 4 #include "lockfile.h" 5 5 #include "credential.h" 6 + #include "path.h" 6 7 #include "string-list.h" 7 8 #include "parse-options.h" 8 9 #include "write-or-die.h"
+2
builtin/for-each-repo.c
··· 3 3 #include "builtin.h" 4 4 #include "gettext.h" 5 5 #include "parse-options.h" 6 + #include "path.h" 7 + #include "repository.h" 6 8 #include "run-command.h" 7 9 #include "string-list.h" 8 10
+1
builtin/help.c
··· 8 8 #include "gettext.h" 9 9 #include "pager.h" 10 10 #include "parse-options.h" 11 + #include "path.h" 11 12 #include "run-command.h" 12 13 #include "config-list.h" 13 14 #include "help.h"
+1
builtin/init-db.c
··· 14 14 #include "exec-cmd.h" 15 15 #include "object-file.h" 16 16 #include "parse-options.h" 17 + #include "path.h" 17 18 #include "setup.h" 18 19 #include "worktree.h" 19 20 #include "wrapper.h"
+1
builtin/merge-index.c
··· 1 1 #define USE_THE_INDEX_VARIABLE 2 2 #include "builtin.h" 3 3 #include "hex.h" 4 + #include "repository.h" 4 5 #include "run-command.h" 5 6 6 7 static const char *pgm;
+2
builtin/merge-recursive.c
··· 3 3 #include "advice.h" 4 4 #include "commit.h" 5 5 #include "gettext.h" 6 + #include "hash.h" 6 7 #include "tag.h" 7 8 #include "merge-recursive.h" 8 9 #include "object-name.h" 10 + #include "repository.h" 9 11 #include "xdiff-interface.h" 10 12 11 13 static const char builtin_merge_recursive_usage[] =
+1
builtin/mv.c
··· 18 18 #include "cache-tree.h" 19 19 #include "string-list.h" 20 20 #include "parse-options.h" 21 + #include "repository.h" 21 22 #include "setup.h" 22 23 #include "submodule.h" 23 24 #include "entry.h"
+1
builtin/push.c
··· 15 15 #include "transport.h" 16 16 #include "parse-options.h" 17 17 #include "pkt-line.h" 18 + #include "repository.h" 18 19 #include "submodule.h" 19 20 #include "submodule-config.h" 20 21 #include "send-pack.h"
+1
builtin/read-tree.c
··· 19 19 #include "dir.h" 20 20 #include "builtin.h" 21 21 #include "parse-options.h" 22 + #include "repository.h" 22 23 #include "resolve-undo.h" 23 24 #include "setup.h" 24 25 #include "submodule.h"
+1
builtin/rerere.c
··· 4 4 #include "dir.h" 5 5 #include "gettext.h" 6 6 #include "parse-options.h" 7 + #include "repository.h" 7 8 #include "string-list.h" 8 9 #include "rerere.h" 9 10 #include "wrapper.h"
+2
builtin/rm.c
··· 12 12 #include "dir.h" 13 13 #include "cache-tree.h" 14 14 #include "gettext.h" 15 + #include "hash.h" 15 16 #include "tree-walk.h" 16 17 #include "object-name.h" 17 18 #include "parse-options.h" 19 + #include "repository.h" 18 20 #include "string-list.h" 19 21 #include "setup.h" 20 22 #include "submodule.h"
+2
builtin/show-branch.c
··· 2 2 #include "config.h" 3 3 #include "environment.h" 4 4 #include "gettext.h" 5 + #include "hash.h" 5 6 #include "hex.h" 6 7 #include "pretty.h" 7 8 #include "refs.h" ··· 10 11 #include "strvec.h" 11 12 #include "object-name.h" 12 13 #include "parse-options.h" 14 + #include "repository.h" 13 15 #include "dir.h" 14 16 #include "commit-slab.h" 15 17 #include "date.h"
+2
builtin/show-index.c
··· 1 1 #include "builtin.h" 2 2 #include "cache.h" 3 3 #include "gettext.h" 4 + #include "hash.h" 4 5 #include "hex.h" 5 6 #include "pack.h" 6 7 #include "parse-options.h" 8 + #include "repository.h" 7 9 8 10 static const char *const show_index_usage[] = { 9 11 "git show-index [--object-format=<hash-algorithm>]",
+2
builtin/update-index.c
··· 9 9 #include "config.h" 10 10 #include "environment.h" 11 11 #include "gettext.h" 12 + #include "hash.h" 12 13 #include "hex.h" 13 14 #include "lockfile.h" 14 15 #include "quote.h" ··· 21 22 #include "parse-options.h" 22 23 #include "pathspec.h" 23 24 #include "dir.h" 25 + #include "repository.h" 24 26 #include "setup.h" 25 27 #include "split-index.h" 26 28 #include "symlinks.h"
+2
builtin/update-ref.c
··· 1 1 #include "cache.h" 2 2 #include "config.h" 3 3 #include "gettext.h" 4 + #include "hash.h" 4 5 #include "refs.h" 5 6 #include "builtin.h" 6 7 #include "object-name.h" 7 8 #include "parse-options.h" 8 9 #include "quote.h" 10 + #include "repository.h" 9 11 #include "strvec.h" 10 12 11 13 static const char * const git_update_ref_usage[] = {
+1
builtin/upload-archive.c
··· 6 6 #include "archive.h" 7 7 #include "pkt-line.h" 8 8 #include "sideband.h" 9 + #include "repository.h" 9 10 #include "run-command.h" 10 11 #include "strvec.h" 11 12
+1
builtin/worktree.c
··· 14 14 #include "strvec.h" 15 15 #include "branch.h" 16 16 #include "refs.h" 17 + #include "repository.h" 17 18 #include "run-command.h" 18 19 #include "hook.h" 19 20 #include "sigchain.h"
+1
checkout.c
··· 2 2 #include "object-name.h" 3 3 #include "remote.h" 4 4 #include "refspec.h" 5 + #include "repository.h" 5 6 #include "checkout.h" 6 7 #include "config.h" 7 8 #include "strbuf.h"
+1 -1
checkout.h
··· 1 1 #ifndef CHECKOUT_H 2 2 #define CHECKOUT_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 /* 7 7 * Check if the branch name uniquely matches a branch name on a remote
+1
chunk-format.c
··· 3 3 #include "chunk-format.h" 4 4 #include "csum-file.h" 5 5 #include "gettext.h" 6 + #include "hash.h" 6 7 #include "trace2.h" 7 8 8 9 /*
+1 -1
chunk-format.h
··· 1 1 #ifndef CHUNK_FORMAT_H 2 2 #define CHUNK_FORMAT_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 struct hashfile; 7 7 struct chunkfile;
+1
common-main.c
··· 2 2 #include "exec-cmd.h" 3 3 #include "gettext.h" 4 4 #include "attr.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 #include "strbuf.h" 7 8 #include "trace2.h"
+1
compat/fsmonitor/fsm-ipc-darwin.c
··· 1 1 #include "cache.h" 2 2 #include "config.h" 3 3 #include "hex.h" 4 + #include "repository.h" 4 5 #include "strbuf.h" 5 6 #include "fsmonitor.h" 6 7 #include "fsmonitor-ipc.h"
+1
compat/fsmonitor/fsm-ipc-win32.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "config.h" 3 3 #include "fsmonitor-ipc.h" 4 + #include "path.h" 4 5 5 6 const char *fsmonitor_ipc__get_path(struct repository *r) { 6 7 static char *ret;
+1
compat/precompose_utf8.c
··· 9 9 #include "config.h" 10 10 #include "environment.h" 11 11 #include "gettext.h" 12 + #include "path.h" 12 13 #include "utf8.h" 13 14 #include "precompose_utf8.h" 14 15
+1
compat/win32/trace2_win32_process_info.c
··· 1 1 #include "../../cache.h" 2 2 #include "../../json-writer.h" 3 + #include "../../repository.h" 3 4 #include "../../trace2.h" 4 5 #include "lazyload.h" 5 6 #include <Psapi.h>
+1 -1
convert.h
··· 4 4 #ifndef CONVERT_H 5 5 #define CONVERT_H 6 6 7 - #include "hash.h" 7 + #include "hash-ll.h" 8 8 #include "string-list.h" 9 9 10 10 struct index_state;
+1
copy.c
··· 1 1 #include "cache.h" 2 2 #include "copy.h" 3 + #include "path.h" 3 4 #include "wrapper.h" 4 5 5 6 int copy_fd(int ifd, int ofd)
+1
csum-file.c
··· 10 10 #include "git-compat-util.h" 11 11 #include "progress.h" 12 12 #include "csum-file.h" 13 + #include "hash.h" 13 14 #include "wrapper.h" 14 15 15 16 static void verify_buffer_or_die(struct hashfile *f,
+1 -1
csum-file.h
··· 1 1 #ifndef CSUM_FILE_H 2 2 #define CSUM_FILE_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 #include "write-or-die.h" 6 6 7 7 struct progress;
+1
daemon.c
··· 3 3 #include "alloc.h" 4 4 #include "config.h" 5 5 #include "environment.h" 6 + #include "path.h" 6 7 #include "pkt-line.h" 7 8 #include "protocol.h" 8 9 #include "run-command.h"
+1 -1
diffcore.h
··· 4 4 #ifndef DIFFCORE_H 5 5 #define DIFFCORE_H 6 6 7 - #include "hash.h" 7 + #include "hash-ll.h" 8 8 9 9 struct diff_options; 10 10 struct mem_pool;
+1
editor.c
··· 6 6 #include "environment.h" 7 7 #include "gettext.h" 8 8 #include "pager.h" 9 + #include "path.h" 9 10 #include "strbuf.h" 10 11 #include "strvec.h" 11 12 #include "run-command.h"
+1
exec-cmd.c
··· 3 3 #include "environment.h" 4 4 #include "exec-cmd.h" 5 5 #include "gettext.h" 6 + #include "path.h" 6 7 #include "quote.h" 7 8 #include "strvec.h" 8 9 #include "trace.h"
+1
fsmonitor-ipc.c
··· 3 3 #include "gettext.h" 4 4 #include "simple-ipc.h" 5 5 #include "fsmonitor-ipc.h" 6 + #include "repository.h" 6 7 #include "run-command.h" 7 8 #include "strbuf.h" 8 9 #include "trace2.h"
+1
gpg-interface.c
··· 7 7 #include "dir.h" 8 8 #include "ident.h" 9 9 #include "gpg-interface.h" 10 + #include "path.h" 10 11 #include "sigchain.h" 11 12 #include "tempfile.h" 12 13 #include "alias.h"
+276
hash-ll.h
··· 1 + #ifndef HASH_LL_H 2 + #define HASH_LL_H 3 + 4 + #if defined(SHA1_APPLE) 5 + #include <CommonCrypto/CommonDigest.h> 6 + #elif defined(SHA1_OPENSSL) 7 + #include <openssl/sha.h> 8 + #elif defined(SHA1_DC) 9 + #include "sha1dc_git.h" 10 + #else /* SHA1_BLK */ 11 + #include "block-sha1/sha1.h" 12 + #endif 13 + 14 + #if defined(SHA256_NETTLE) 15 + #include "sha256/nettle.h" 16 + #elif defined(SHA256_GCRYPT) 17 + #define SHA256_NEEDS_CLONE_HELPER 18 + #include "sha256/gcrypt.h" 19 + #elif defined(SHA256_OPENSSL) 20 + #include <openssl/sha.h> 21 + #else 22 + #include "sha256/block/sha256.h" 23 + #endif 24 + 25 + #ifndef platform_SHA_CTX 26 + /* 27 + * platform's underlying implementation of SHA-1; could be OpenSSL, 28 + * blk_SHA, Apple CommonCrypto, etc... Note that the relevant 29 + * SHA-1 header may have already defined platform_SHA_CTX for our 30 + * own implementations like block-sha1, so we list 31 + * the default for OpenSSL compatible SHA-1 implementations here. 32 + */ 33 + #define platform_SHA_CTX SHA_CTX 34 + #define platform_SHA1_Init SHA1_Init 35 + #define platform_SHA1_Update SHA1_Update 36 + #define platform_SHA1_Final SHA1_Final 37 + #endif 38 + 39 + #define git_SHA_CTX platform_SHA_CTX 40 + #define git_SHA1_Init platform_SHA1_Init 41 + #define git_SHA1_Update platform_SHA1_Update 42 + #define git_SHA1_Final platform_SHA1_Final 43 + 44 + #ifndef platform_SHA256_CTX 45 + #define platform_SHA256_CTX SHA256_CTX 46 + #define platform_SHA256_Init SHA256_Init 47 + #define platform_SHA256_Update SHA256_Update 48 + #define platform_SHA256_Final SHA256_Final 49 + #endif 50 + 51 + #define git_SHA256_CTX platform_SHA256_CTX 52 + #define git_SHA256_Init platform_SHA256_Init 53 + #define git_SHA256_Update platform_SHA256_Update 54 + #define git_SHA256_Final platform_SHA256_Final 55 + 56 + #ifdef platform_SHA256_Clone 57 + #define git_SHA256_Clone platform_SHA256_Clone 58 + #endif 59 + 60 + #ifdef SHA1_MAX_BLOCK_SIZE 61 + #include "compat/sha1-chunked.h" 62 + #undef git_SHA1_Update 63 + #define git_SHA1_Update git_SHA1_Update_Chunked 64 + #endif 65 + 66 + static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src) 67 + { 68 + memcpy(dst, src, sizeof(*dst)); 69 + } 70 + 71 + #ifndef SHA256_NEEDS_CLONE_HELPER 72 + static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src) 73 + { 74 + memcpy(dst, src, sizeof(*dst)); 75 + } 76 + #endif 77 + 78 + /* 79 + * Note that these constants are suitable for indexing the hash_algos array and 80 + * comparing against each other, but are otherwise arbitrary, so they should not 81 + * be exposed to the user or serialized to disk. To know whether a 82 + * git_hash_algo struct points to some usable hash function, test the format_id 83 + * field for being non-zero. Use the name field for user-visible situations and 84 + * the format_id field for fixed-length fields on disk. 85 + */ 86 + /* An unknown hash function. */ 87 + #define GIT_HASH_UNKNOWN 0 88 + /* SHA-1 */ 89 + #define GIT_HASH_SHA1 1 90 + /* SHA-256 */ 91 + #define GIT_HASH_SHA256 2 92 + /* Number of algorithms supported (including unknown). */ 93 + #define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) 94 + 95 + /* "sha1", big-endian */ 96 + #define GIT_SHA1_FORMAT_ID 0x73686131 97 + 98 + /* The length in bytes and in hex digits of an object name (SHA-1 value). */ 99 + #define GIT_SHA1_RAWSZ 20 100 + #define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ) 101 + /* The block size of SHA-1. */ 102 + #define GIT_SHA1_BLKSZ 64 103 + 104 + /* "s256", big-endian */ 105 + #define GIT_SHA256_FORMAT_ID 0x73323536 106 + 107 + /* The length in bytes and in hex digits of an object name (SHA-256 value). */ 108 + #define GIT_SHA256_RAWSZ 32 109 + #define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ) 110 + /* The block size of SHA-256. */ 111 + #define GIT_SHA256_BLKSZ 64 112 + 113 + /* The length in byte and in hex digits of the largest possible hash value. */ 114 + #define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ 115 + #define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ 116 + /* The largest possible block size for any supported hash. */ 117 + #define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ 118 + 119 + struct object_id { 120 + unsigned char hash[GIT_MAX_RAWSZ]; 121 + int algo; /* XXX requires 4-byte alignment */ 122 + }; 123 + 124 + #define GET_OID_QUIETLY 01 125 + #define GET_OID_COMMIT 02 126 + #define GET_OID_COMMITTISH 04 127 + #define GET_OID_TREE 010 128 + #define GET_OID_TREEISH 020 129 + #define GET_OID_BLOB 040 130 + #define GET_OID_FOLLOW_SYMLINKS 0100 131 + #define GET_OID_RECORD_PATH 0200 132 + #define GET_OID_ONLY_TO_DIE 04000 133 + #define GET_OID_REQUIRE_PATH 010000 134 + 135 + #define GET_OID_DISAMBIGUATORS \ 136 + (GET_OID_COMMIT | GET_OID_COMMITTISH | \ 137 + GET_OID_TREE | GET_OID_TREEISH | \ 138 + GET_OID_BLOB) 139 + 140 + enum get_oid_result { 141 + FOUND = 0, 142 + MISSING_OBJECT = -1, /* The requested object is missing */ 143 + SHORT_NAME_AMBIGUOUS = -2, 144 + /* The following only apply when symlinks are followed */ 145 + DANGLING_SYMLINK = -4, /* 146 + * The initial symlink is there, but 147 + * (transitively) points to a missing 148 + * in-tree file 149 + */ 150 + SYMLINK_LOOP = -5, 151 + NOT_DIR = -6, /* 152 + * Somewhere along the symlink chain, a path is 153 + * requested which contains a file as a 154 + * non-final element. 155 + */ 156 + }; 157 + 158 + /* A suitably aligned type for stack allocations of hash contexts. */ 159 + union git_hash_ctx { 160 + git_SHA_CTX sha1; 161 + git_SHA256_CTX sha256; 162 + }; 163 + typedef union git_hash_ctx git_hash_ctx; 164 + 165 + typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); 166 + typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); 167 + typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); 168 + typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); 169 + typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); 170 + 171 + struct git_hash_algo { 172 + /* 173 + * The name of the algorithm, as appears in the config file and in 174 + * messages. 175 + */ 176 + const char *name; 177 + 178 + /* A four-byte version identifier, used in pack indices. */ 179 + uint32_t format_id; 180 + 181 + /* The length of the hash in binary. */ 182 + size_t rawsz; 183 + 184 + /* The length of the hash in hex characters. */ 185 + size_t hexsz; 186 + 187 + /* The block size of the hash. */ 188 + size_t blksz; 189 + 190 + /* The hash initialization function. */ 191 + git_hash_init_fn init_fn; 192 + 193 + /* The hash context cloning function. */ 194 + git_hash_clone_fn clone_fn; 195 + 196 + /* The hash update function. */ 197 + git_hash_update_fn update_fn; 198 + 199 + /* The hash finalization function. */ 200 + git_hash_final_fn final_fn; 201 + 202 + /* The hash finalization function for object IDs. */ 203 + git_hash_final_oid_fn final_oid_fn; 204 + 205 + /* The OID of the empty tree. */ 206 + const struct object_id *empty_tree; 207 + 208 + /* The OID of the empty blob. */ 209 + const struct object_id *empty_blob; 210 + 211 + /* The all-zeros OID. */ 212 + const struct object_id *null_oid; 213 + }; 214 + extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS]; 215 + 216 + /* 217 + * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if 218 + * the name doesn't match a known algorithm. 219 + */ 220 + int hash_algo_by_name(const char *name); 221 + /* Identical, except based on the format ID. */ 222 + int hash_algo_by_id(uint32_t format_id); 223 + /* Identical, except based on the length. */ 224 + int hash_algo_by_length(int len); 225 + /* Identical, except for a pointer to struct git_hash_algo. */ 226 + static inline int hash_algo_by_ptr(const struct git_hash_algo *p) 227 + { 228 + return p - hash_algos; 229 + } 230 + 231 + const struct object_id *null_oid(void); 232 + 233 + static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 234 + { 235 + /* 236 + * Teach the compiler that there are only two possibilities of hash size 237 + * here, so that it can optimize for this case as much as possible. 238 + */ 239 + if (algop->rawsz == GIT_MAX_RAWSZ) 240 + return memcmp(sha1, sha2, GIT_MAX_RAWSZ); 241 + return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); 242 + } 243 + 244 + static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 245 + { 246 + /* 247 + * We write this here instead of deferring to hashcmp so that the 248 + * compiler can properly inline it and avoid calling memcmp. 249 + */ 250 + if (algop->rawsz == GIT_MAX_RAWSZ) 251 + return !memcmp(sha1, sha2, GIT_MAX_RAWSZ); 252 + return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ); 253 + } 254 + 255 + static inline void oidcpy(struct object_id *dst, const struct object_id *src) 256 + { 257 + memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ); 258 + dst->algo = src->algo; 259 + } 260 + 261 + static inline struct object_id *oiddup(const struct object_id *src) 262 + { 263 + struct object_id *dst = xmalloc(sizeof(struct object_id)); 264 + oidcpy(dst, src); 265 + return dst; 266 + } 267 + 268 + static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) 269 + { 270 + oid->algo = hash_algo_by_ptr(algop); 271 + } 272 + 273 + const char *empty_tree_oid_hex(void); 274 + const char *empty_blob_oid_hex(void); 275 + 276 + #endif
+1
hash-lookup.c
··· 1 1 #include "cache.h" 2 + #include "hash.h" 2 3 #include "hash-lookup.h" 3 4 4 5 static uint32_t take2(const struct object_id *oid, size_t ofs)
+1 -272
hash.h
··· 1 1 #ifndef HASH_H 2 2 #define HASH_H 3 3 4 + #include "hash-ll.h" 4 5 #include "repository.h" 5 6 6 - #if defined(SHA1_APPLE) 7 - #include <CommonCrypto/CommonDigest.h> 8 - #elif defined(SHA1_OPENSSL) 9 - #include <openssl/sha.h> 10 - #elif defined(SHA1_DC) 11 - #include "sha1dc_git.h" 12 - #else /* SHA1_BLK */ 13 - #include "block-sha1/sha1.h" 14 - #endif 15 - 16 - #if defined(SHA256_NETTLE) 17 - #include "sha256/nettle.h" 18 - #elif defined(SHA256_GCRYPT) 19 - #define SHA256_NEEDS_CLONE_HELPER 20 - #include "sha256/gcrypt.h" 21 - #elif defined(SHA256_OPENSSL) 22 - #include <openssl/sha.h> 23 - #else 24 - #include "sha256/block/sha256.h" 25 - #endif 26 - 27 - #ifndef platform_SHA_CTX 28 - /* 29 - * platform's underlying implementation of SHA-1; could be OpenSSL, 30 - * blk_SHA, Apple CommonCrypto, etc... Note that the relevant 31 - * SHA-1 header may have already defined platform_SHA_CTX for our 32 - * own implementations like block-sha1, so we list 33 - * the default for OpenSSL compatible SHA-1 implementations here. 34 - */ 35 - #define platform_SHA_CTX SHA_CTX 36 - #define platform_SHA1_Init SHA1_Init 37 - #define platform_SHA1_Update SHA1_Update 38 - #define platform_SHA1_Final SHA1_Final 39 - #endif 40 - 41 - #define git_SHA_CTX platform_SHA_CTX 42 - #define git_SHA1_Init platform_SHA1_Init 43 - #define git_SHA1_Update platform_SHA1_Update 44 - #define git_SHA1_Final platform_SHA1_Final 45 - 46 - #ifndef platform_SHA256_CTX 47 - #define platform_SHA256_CTX SHA256_CTX 48 - #define platform_SHA256_Init SHA256_Init 49 - #define platform_SHA256_Update SHA256_Update 50 - #define platform_SHA256_Final SHA256_Final 51 - #endif 52 - 53 - #define git_SHA256_CTX platform_SHA256_CTX 54 - #define git_SHA256_Init platform_SHA256_Init 55 - #define git_SHA256_Update platform_SHA256_Update 56 - #define git_SHA256_Final platform_SHA256_Final 57 - 58 - #ifdef platform_SHA256_Clone 59 - #define git_SHA256_Clone platform_SHA256_Clone 60 - #endif 61 - 62 - #ifdef SHA1_MAX_BLOCK_SIZE 63 - #include "compat/sha1-chunked.h" 64 - #undef git_SHA1_Update 65 - #define git_SHA1_Update git_SHA1_Update_Chunked 66 - #endif 67 - 68 - static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src) 69 - { 70 - memcpy(dst, src, sizeof(*dst)); 71 - } 72 - 73 - #ifndef SHA256_NEEDS_CLONE_HELPER 74 - static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src) 75 - { 76 - memcpy(dst, src, sizeof(*dst)); 77 - } 78 - #endif 79 - 80 - /* 81 - * Note that these constants are suitable for indexing the hash_algos array and 82 - * comparing against each other, but are otherwise arbitrary, so they should not 83 - * be exposed to the user or serialized to disk. To know whether a 84 - * git_hash_algo struct points to some usable hash function, test the format_id 85 - * field for being non-zero. Use the name field for user-visible situations and 86 - * the format_id field for fixed-length fields on disk. 87 - */ 88 - /* An unknown hash function. */ 89 - #define GIT_HASH_UNKNOWN 0 90 - /* SHA-1 */ 91 - #define GIT_HASH_SHA1 1 92 - /* SHA-256 */ 93 - #define GIT_HASH_SHA256 2 94 - /* Number of algorithms supported (including unknown). */ 95 - #define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) 96 - 97 - /* "sha1", big-endian */ 98 - #define GIT_SHA1_FORMAT_ID 0x73686131 99 - 100 - /* The length in bytes and in hex digits of an object name (SHA-1 value). */ 101 - #define GIT_SHA1_RAWSZ 20 102 - #define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ) 103 - /* The block size of SHA-1. */ 104 - #define GIT_SHA1_BLKSZ 64 105 - 106 - /* "s256", big-endian */ 107 - #define GIT_SHA256_FORMAT_ID 0x73323536 108 - 109 - /* The length in bytes and in hex digits of an object name (SHA-256 value). */ 110 - #define GIT_SHA256_RAWSZ 32 111 - #define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ) 112 - /* The block size of SHA-256. */ 113 - #define GIT_SHA256_BLKSZ 64 114 - 115 - /* The length in byte and in hex digits of the largest possible hash value. */ 116 - #define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ 117 - #define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ 118 - /* The largest possible block size for any supported hash. */ 119 - #define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ 120 - 121 - struct object_id { 122 - unsigned char hash[GIT_MAX_RAWSZ]; 123 - int algo; /* XXX requires 4-byte alignment */ 124 - }; 125 - 126 - #define GET_OID_QUIETLY 01 127 - #define GET_OID_COMMIT 02 128 - #define GET_OID_COMMITTISH 04 129 - #define GET_OID_TREE 010 130 - #define GET_OID_TREEISH 020 131 - #define GET_OID_BLOB 040 132 - #define GET_OID_FOLLOW_SYMLINKS 0100 133 - #define GET_OID_RECORD_PATH 0200 134 - #define GET_OID_ONLY_TO_DIE 04000 135 - #define GET_OID_REQUIRE_PATH 010000 136 - 137 - #define GET_OID_DISAMBIGUATORS \ 138 - (GET_OID_COMMIT | GET_OID_COMMITTISH | \ 139 - GET_OID_TREE | GET_OID_TREEISH | \ 140 - GET_OID_BLOB) 141 - 142 - enum get_oid_result { 143 - FOUND = 0, 144 - MISSING_OBJECT = -1, /* The requested object is missing */ 145 - SHORT_NAME_AMBIGUOUS = -2, 146 - /* The following only apply when symlinks are followed */ 147 - DANGLING_SYMLINK = -4, /* 148 - * The initial symlink is there, but 149 - * (transitively) points to a missing 150 - * in-tree file 151 - */ 152 - SYMLINK_LOOP = -5, 153 - NOT_DIR = -6, /* 154 - * Somewhere along the symlink chain, a path is 155 - * requested which contains a file as a 156 - * non-final element. 157 - */ 158 - }; 159 - 160 - /* A suitably aligned type for stack allocations of hash contexts. */ 161 - union git_hash_ctx { 162 - git_SHA_CTX sha1; 163 - git_SHA256_CTX sha256; 164 - }; 165 - typedef union git_hash_ctx git_hash_ctx; 166 - 167 - typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); 168 - typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); 169 - typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); 170 - typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); 171 - typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); 172 - 173 - struct git_hash_algo { 174 - /* 175 - * The name of the algorithm, as appears in the config file and in 176 - * messages. 177 - */ 178 - const char *name; 179 - 180 - /* A four-byte version identifier, used in pack indices. */ 181 - uint32_t format_id; 182 - 183 - /* The length of the hash in binary. */ 184 - size_t rawsz; 185 - 186 - /* The length of the hash in hex characters. */ 187 - size_t hexsz; 188 - 189 - /* The block size of the hash. */ 190 - size_t blksz; 191 - 192 - /* The hash initialization function. */ 193 - git_hash_init_fn init_fn; 194 - 195 - /* The hash context cloning function. */ 196 - git_hash_clone_fn clone_fn; 197 - 198 - /* The hash update function. */ 199 - git_hash_update_fn update_fn; 200 - 201 - /* The hash finalization function. */ 202 - git_hash_final_fn final_fn; 203 - 204 - /* The hash finalization function for object IDs. */ 205 - git_hash_final_oid_fn final_oid_fn; 206 - 207 - /* The OID of the empty tree. */ 208 - const struct object_id *empty_tree; 209 - 210 - /* The OID of the empty blob. */ 211 - const struct object_id *empty_blob; 212 - 213 - /* The all-zeros OID. */ 214 - const struct object_id *null_oid; 215 - }; 216 - extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS]; 217 - 218 - /* 219 - * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if 220 - * the name doesn't match a known algorithm. 221 - */ 222 - int hash_algo_by_name(const char *name); 223 - /* Identical, except based on the format ID. */ 224 - int hash_algo_by_id(uint32_t format_id); 225 - /* Identical, except based on the length. */ 226 - int hash_algo_by_length(int len); 227 - /* Identical, except for a pointer to struct git_hash_algo. */ 228 - static inline int hash_algo_by_ptr(const struct git_hash_algo *p) 229 - { 230 - return p - hash_algos; 231 - } 232 - 233 7 #define the_hash_algo the_repository->hash_algo 234 8 235 - const struct object_id *null_oid(void); 236 - 237 - static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 238 - { 239 - /* 240 - * Teach the compiler that there are only two possibilities of hash size 241 - * here, so that it can optimize for this case as much as possible. 242 - */ 243 - if (algop->rawsz == GIT_MAX_RAWSZ) 244 - return memcmp(sha1, sha2, GIT_MAX_RAWSZ); 245 - return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); 246 - } 247 - 248 9 static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) 249 10 { 250 11 return hashcmp_algop(sha1, sha2, the_hash_algo); ··· 260 21 return hashcmp_algop(oid1->hash, oid2->hash, algop); 261 22 } 262 23 263 - static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 264 - { 265 - /* 266 - * We write this here instead of deferring to hashcmp so that the 267 - * compiler can properly inline it and avoid calling memcmp. 268 - */ 269 - if (algop->rawsz == GIT_MAX_RAWSZ) 270 - return !memcmp(sha1, sha2, GIT_MAX_RAWSZ); 271 - return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ); 272 - } 273 - 274 24 static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) 275 25 { 276 26 return hasheq_algop(sha1, sha2, the_hash_algo); ··· 296 46 memcpy(sha_dst, sha_src, the_hash_algo->rawsz); 297 47 } 298 48 299 - static inline void oidcpy(struct object_id *dst, const struct object_id *src) 300 - { 301 - memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ); 302 - dst->algo = src->algo; 303 - } 304 - 305 49 /* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ 306 50 static inline void oidcpy_with_padding(struct object_id *dst, 307 51 const struct object_id *src) ··· 316 60 memcpy(dst->hash, src->hash, hashsz); 317 61 memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); 318 62 dst->algo = src->algo; 319 - } 320 - 321 - static inline struct object_id *oiddup(const struct object_id *src) 322 - { 323 - struct object_id *dst = xmalloc(sizeof(struct object_id)); 324 - oidcpy(dst, src); 325 - return dst; 326 63 } 327 64 328 65 static inline void hashclr(unsigned char *hash) ··· 361 98 { 362 99 return oideq(oid, the_hash_algo->empty_tree); 363 100 } 364 - 365 - static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) 366 - { 367 - oid->algo = hash_algo_by_ptr(algop); 368 - } 369 - 370 - const char *empty_tree_oid_hex(void); 371 - const char *empty_blob_oid_hex(void); 372 101 373 102 #endif
+1 -1
hashmap.h
··· 1 1 #ifndef HASHMAP_H 2 2 #define HASHMAP_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 /* 7 7 * Generic implementation of hash-based key-value mappings.
+1
hex.c
··· 1 1 #include "git-compat-util.h" 2 + #include "hash.h" 2 3 #include "hex.h" 3 4 4 5 const signed char hexval_table[256] = {
+1 -1
hex.h
··· 1 1 #ifndef HEX_H 2 2 #define HEX_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 extern const signed char hexval_table[256]; 7 7 static inline unsigned int hexval(unsigned char c)
+1
hook.c
··· 2 2 #include "advice.h" 3 3 #include "gettext.h" 4 4 #include "hook.h" 5 + #include "path.h" 5 6 #include "run-command.h" 6 7 #include "config.h" 7 8 #include "strbuf.h"
+1
khash.h
··· 27 27 #define __AC_KHASH_H 28 28 29 29 #include "hashmap.h" 30 + #include "hash.h" 30 31 31 32 #define AC_VERSION_KHASH_H "0.2.8" 32 33
+1
ls-refs.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "environment.h" 3 3 #include "gettext.h" 4 + #include "hash.h" 4 5 #include "hex.h" 5 6 #include "repository.h" 6 7 #include "refs.h"
+1
merge-ort-wrappers.c
··· 1 1 #include "cache.h" 2 2 #include "gettext.h" 3 + #include "hash.h" 3 4 #include "merge-ort.h" 4 5 #include "merge-ort-wrappers.h" 5 6
+1 -1
merge-ort.h
··· 2 2 #define MERGE_ORT_H 3 3 4 4 #include "merge-recursive.h" 5 - #include "hash.h" 5 + #include "hash-ll.h" 6 6 7 7 struct commit; 8 8 struct tree;
+1
negotiator/default.c
··· 4 4 #include "../fetch-negotiator.h" 5 5 #include "../prio-queue.h" 6 6 #include "../refs.h" 7 + #include "../repository.h" 7 8 #include "../tag.h" 8 9 9 10 /* Remember to update object flag allocation in object.h */
+1
negotiator/skipping.c
··· 5 5 #include "../hex.h" 6 6 #include "../prio-queue.h" 7 7 #include "../refs.h" 8 + #include "../repository.h" 8 9 #include "../tag.h" 9 10 10 11 /* Remember to update object flag allocation in object.h */
+2
object-file.h
··· 4 4 #include "git-zlib.h" 5 5 #include "object.h" 6 6 7 + struct index_state; 8 + 7 9 /* 8 10 * Set this to 0 to prevent oid_object_info_extended() from fetching missing 9 11 * blobs. This has a difference only if extensions.partialClone is set.
+2 -1
object.h
··· 1 1 #ifndef OBJECT_H 2 2 #define OBJECT_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 struct buffer_slab; 7 + struct repository; 7 8 8 9 struct parsed_object_pool { 9 10 struct object **obj_hash;
+1
oidmap.c
··· 1 1 #include "git-compat-util.h" 2 + #include "hash.h" 2 3 #include "oidmap.h" 3 4 4 5 static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,
+1 -1
oidtree.h
··· 2 2 #define OIDTREE_H 3 3 4 4 #include "cbtree.h" 5 - #include "hash.h" 5 + #include "hash-ll.h" 6 6 #include "mem-pool.h" 7 7 8 8 struct oidtree {
+1
parallel-checkout.c
··· 3 3 #include "config.h" 4 4 #include "entry.h" 5 5 #include "gettext.h" 6 + #include "hash.h" 6 7 #include "hex.h" 7 8 #include "parallel-checkout.h" 8 9 #include "pkt-line.h"
+1
pathspec.c
··· 6 6 #include "gettext.h" 7 7 #include "pathspec.h" 8 8 #include "attr.h" 9 + #include "repository.h" 9 10 #include "setup.h" 10 11 #include "strvec.h" 11 12 #include "symlinks.h"
+1
progress.c
··· 12 12 #include "git-compat-util.h" 13 13 #include "pager.h" 14 14 #include "progress.h" 15 + #include "repository.h" 15 16 #include "strbuf.h" 16 17 #include "trace.h" 17 18 #include "trace2.h"
+1 -1
protocol-caps.c
··· 4 4 #include "hex.h" 5 5 #include "pkt-line.h" 6 6 #include "strvec.h" 7 - #include "hash.h" 7 + #include "hash-ll.h" 8 8 #include "hex.h" 9 9 #include "object.h" 10 10 #include "object-store.h"
+1
rebase-interactive.c
··· 5 5 #include "gettext.h" 6 6 #include "sequencer.h" 7 7 #include "rebase-interactive.h" 8 + #include "repository.h" 8 9 #include "strbuf.h" 9 10 #include "commit-slab.h" 10 11 #include "config.h"
+1
refs/files-backend.c
··· 3 3 #include "../copy.h" 4 4 #include "../environment.h" 5 5 #include "../gettext.h" 6 + #include "../hash.h" 6 7 #include "../hex.h" 7 8 #include "../refs.h" 8 9 #include "refs-internal.h"
+1
refs/packed-backend.c
··· 2 2 #include "../alloc.h" 3 3 #include "../config.h" 4 4 #include "../gettext.h" 5 + #include "../hash.h" 5 6 #include "../hex.h" 6 7 #include "../refs.h" 7 8 #include "refs-internal.h"
+2
refs/ref-cache.c
··· 1 1 #include "../git-compat-util.h" 2 2 #include "../alloc.h" 3 + #include "../hash.h" 3 4 #include "../refs.h" 5 + #include "../repository.h" 4 6 #include "refs-internal.h" 5 7 #include "ref-cache.h" 6 8 #include "../iterator.h"
+2 -1
refs/ref-cache.h
··· 1 1 #ifndef REFS_REF_CACHE_H 2 2 #define REFS_REF_CACHE_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 struct ref_dir; 7 7 struct ref_store; 8 + struct repository; 8 9 9 10 /* 10 11 * If this ref_cache is filled lazily, this function is used to load
+1
refspec.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "alloc.h" 3 3 #include "gettext.h" 4 + #include "hash.h" 4 5 #include "hex.h" 5 6 #include "strvec.h" 6 7 #include "refs.h"
+1 -1
reftable/dump.c
··· 7 7 */ 8 8 9 9 #include "git-compat-util.h" 10 - #include "hash.h" 10 + #include "hash-ll.h" 11 11 12 12 #include "reftable-blocksource.h" 13 13 #include "reftable-error.h"
+1 -1
reftable/system.h
··· 13 13 14 14 #include "git-compat-util.h" 15 15 #include "strbuf.h" 16 - #include "hash.h" /* hash ID, sizes.*/ 16 + #include "hash-ll.h" /* hash ID, sizes.*/ 17 17 #include "dir.h" /* remove_dir_recursively, for tests.*/ 18 18 19 19 int hash_size(uint32_t id);
+1 -1
reset.h
··· 1 1 #ifndef RESET_H 2 2 #define RESET_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 #include "repository.h" 6 6 7 7 #define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
+1
resolve-undo.c
··· 1 1 #include "cache.h" 2 2 #include "dir.h" 3 + #include "hash.h" 3 4 #include "resolve-undo.h" 4 5 #include "string-list.h" 5 6
+1 -1
resolve-undo.h
··· 6 6 struct pathspec; 7 7 struct string_list; 8 8 9 - #include "hash.h" 9 + #include "hash-ll.h" 10 10 11 11 struct resolve_undo_info { 12 12 unsigned int mode[3];
+1
split-index.c
··· 1 1 #include "cache.h" 2 2 #include "alloc.h" 3 3 #include "gettext.h" 4 + #include "hash.h" 4 5 #include "mem-pool.h" 5 6 #include "split-index.h" 6 7 #include "strbuf.h"
+1 -1
split-index.h
··· 1 1 #ifndef SPLIT_INDEX_H 2 2 #define SPLIT_INDEX_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 struct index_state; 7 7 struct strbuf;
+1
strbuf.c
··· 6 6 #include "hex.h" 7 7 #include "object-name.h" 8 8 #include "refs.h" 9 + #include "repository.h" 9 10 #include "string-list.h" 10 11 #include "utf8.h" 11 12 #include "date.h"
+1
t/helper/test-bloom.c
··· 2 2 #include "bloom.h" 3 3 #include "hex.h" 4 4 #include "commit.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 7 8 static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
+1
t/helper/test-cache-tree.c
··· 6 6 #include "tree.h" 7 7 #include "cache-tree.h" 8 8 #include "parse-options.h" 9 + #include "repository.h" 9 10 #include "setup.h" 10 11 11 12 static char const * const test_cache_tree_usage[] = {
+2
t/helper/test-dump-cache-tree.c
··· 1 1 #define USE_THE_INDEX_VARIABLE 2 2 #include "test-tool.h" 3 3 #include "cache.h" 4 + #include "hash.h" 4 5 #include "hex.h" 5 6 #include "tree.h" 6 7 #include "cache-tree.h" 8 + #include "repository.h" 7 9 #include "setup.h" 8 10 9 11 static void dump_one(struct cache_tree *it, const char *pfx, const char *x)
+1
t/helper/test-dump-fsmonitor.c
··· 1 1 #include "test-tool.h" 2 2 #include "cache.h" 3 + #include "repository.h" 3 4 #include "setup.h" 4 5 5 6 int cmd__dump_fsmonitor(int ac, const char **av)
+1
t/helper/test-dump-untracked-cache.c
··· 3 3 #include "cache.h" 4 4 #include "dir.h" 5 5 #include "hex.h" 6 + #include "repository.h" 6 7 #include "setup.h" 7 8 8 9 static int compare_untracked(const void *a_, const void *b_)
+1
t/helper/test-example-decorate.c
··· 2 2 #include "git-compat-util.h" 3 3 #include "object.h" 4 4 #include "decorate.h" 5 + #include "repository.h" 5 6 6 7 int cmd__example_decorate(int argc, const char **argv) 7 8 {
+1
t/helper/test-fsmonitor-client.c
··· 7 7 #include "cache.h" 8 8 #include "parse-options.h" 9 9 #include "fsmonitor-ipc.h" 10 + #include "repository.h" 10 11 #include "setup.h" 11 12 #include "thread-utils.h" 12 13 #include "trace2.h"
+1
t/helper/test-lazy-init-name-hash.c
··· 3 3 #include "cache.h" 4 4 #include "environment.h" 5 5 #include "parse-options.h" 6 + #include "repository.h" 6 7 #include "setup.h" 7 8 #include "trace.h" 8 9
+1
t/helper/test-match-trees.c
··· 3 3 #include "hex.h" 4 4 #include "match-trees.h" 5 5 #include "object-name.h" 6 + #include "repository.h" 6 7 #include "setup.h" 7 8 #include "tree.h" 8 9
+1
t/helper/test-oidmap.c
··· 2 2 #include "hex.h" 3 3 #include "object-name.h" 4 4 #include "oidmap.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 #include "strbuf.h" 7 8
+1
t/helper/test-path-utils.c
··· 2 2 #include "cache.h" 3 3 #include "abspath.h" 4 4 #include "environment.h" 5 + #include "path.h" 5 6 #include "setup.h" 6 7 #include "string-list.h" 7 8 #include "trace.h"
+1
t/helper/test-read-cache.c
··· 2 2 #include "test-tool.h" 3 3 #include "cache.h" 4 4 #include "config.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 #include "wrapper.h" 7 8
+1
t/helper/test-scrap-cache-tree.c
··· 2 2 #include "test-tool.h" 3 3 #include "cache.h" 4 4 #include "lockfile.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 #include "tree.h" 7 8 #include "cache-tree.h"
+2
t/helper/test-submodule-config.c
··· 1 1 #include "test-tool.h" 2 2 #include "config.h" 3 + #include "hash.h" 3 4 #include "object-name.h" 5 + #include "repository.h" 4 6 #include "setup.h" 5 7 #include "submodule-config.h" 6 8 #include "submodule.h"
+1
t/helper/test-submodule-nested-repo-config.c
··· 1 1 #include "test-tool.h" 2 + #include "repository.h" 2 3 #include "setup.h" 3 4 #include "submodule-config.h" 4 5
+1
t/helper/test-submodule.c
··· 2 2 #include "test-tool-utils.h" 3 3 #include "parse-options.h" 4 4 #include "remote.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 #include "submodule-config.h" 7 8 #include "submodule.h"
+1
t/helper/test-trace2.c
··· 3 3 #include "run-command.h" 4 4 #include "exec-cmd.h" 5 5 #include "config.h" 6 + #include "repository.h" 6 7 #include "trace2.h" 7 8 8 9 typedef int(fn_unit_test)(int argc, const char **argv);
+1
t/helper/test-write-cache.c
··· 2 2 #include "test-tool.h" 3 3 #include "cache.h" 4 4 #include "lockfile.h" 5 + #include "repository.h" 5 6 #include "setup.h" 6 7 7 8 int cmd__write_cache(int argc, const char **argv)
+1
trace2.c
··· 2 2 #include "config.h" 3 3 #include "json-writer.h" 4 4 #include "quote.h" 5 + #include "repository.h" 5 6 #include "run-command.h" 6 7 #include "sigchain.h" 7 8 #include "thread-utils.h"
+1
trace2/tr2_tgt_event.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "config.h" 3 3 #include "json-writer.h" 4 + #include "repository.h" 4 5 #include "run-command.h" 5 6 #include "version.h" 6 7 #include "trace2/tr2_dst.h"
+1
trace2/tr2_tgt_normal.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "config.h" 3 + #include "repository.h" 3 4 #include "run-command.h" 4 5 #include "quote.h" 5 6 #include "version.h"
+1
trace2/tr2_tgt_perf.c
··· 1 1 #include "git-compat-util.h" 2 2 #include "config.h" 3 + #include "repository.h" 3 4 #include "run-command.h" 4 5 #include "quote.h" 5 6 #include "version.h"
+2 -1
tree-walk.h
··· 1 1 #ifndef TREE_WALK_H 2 2 #define TREE_WALK_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 6 6 struct index_state; 7 + struct repository; 7 8 8 9 #define MAX_TRAVERSE_TREES 8 9 10
+1
tree.h
··· 3 3 4 4 #include "object.h" 5 5 6 + struct pathspec; 6 7 struct repository; 7 8 struct strbuf; 8 9
+1
wrapper.c
··· 5 5 #include "abspath.h" 6 6 #include "config.h" 7 7 #include "gettext.h" 8 + #include "repository.h" 8 9 #include "strbuf.h" 9 10 #include "trace2.h" 10 11 #include "wrapper.h"
+1 -1
xdiff-interface.h
··· 1 1 #ifndef XDIFF_INTERFACE_H 2 2 #define XDIFF_INTERFACE_H 3 3 4 - #include "hash.h" 4 + #include "hash-ll.h" 5 5 #include "xdiff/xdiff.h" 6 6 7 7 /*