Header cleanups (final splitting of cache.h, and some splitting of other headers)
Subsystems (2)
PATCH v2 7/27 read-cache: move shared add/checkout/commit code
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The function add_files_to_cache(), plus associated helper functions, were defined in builtin/add.c, but also shared with builtin/checkout.c and builtin/commit.c. Move these shared functions to read-cache.c.
Diff best viewed with --color-moved.
--- builtin/add.c | 100 ------------------------------------------------- read-cache.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 100 deletions(-)
builtin/add.c +0 -100
@@ -36,13 +36,6 @@ static int pathspec_file_nul;static int include_sparse;static const char *pathspec_from_file; -struct update_callback_data { -struct index_state *index; -int include_sparse; -int flags; -int add_errors; -}; -static int chmod_pathspec (struct pathspec *pathspec,char flip,int show_only) {int i, ret =0 ;
@@ -71,99 +64,6 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)return ret; } -static int fix_unmerged_status (struct diff_filepair *p, -struct update_callback_data *data) -{ -if (p->status !=DIFF_STATUS_UNMERGED ) -return p->status; -if (!(data->flags &ADD_CACHE_IGNORE_REMOVAL ) && !p->two->mode) -/* -* This is not an explicit add request, and the -* path is missing from the working tree (deleted) -*/ -return DIFF_STATUS_DELETED ; -else -/* -* Either an explicit add request, or path exists -* in the working tree. An attempt to explicitly -* add a path that does not exist in the working tree -* will be caught as an error by the caller immediately. -*/ -return DIFF_STATUS_MODIFIED ; -} - -static void update_callback (struct diff_queue_struct *q, - struct diff_options *opt UNUSED, void *cbdata) -{ -int i; -struct update_callback_data *data = cbdata; - -for (i =0 ; i < q->nr; i++) { -struct diff_filepair *p = q->queue[i]; -const char *path = p->one->path; - -if (!data->include_sparse && - !path_in_sparse_checkout (path, data->index)) -continue ; - -switch (fix_unmerged_status (p, data)) { -default : -die (_ ("unexpected diff status %c" ), p->status); -case DIFF_STATUS_MODIFIED : -case DIFF_STATUS_TYPE_CHANGED : -if (add_file_to_index (data->index, path, data->flags)) { -if (!(data->flags &ADD_CACHE_IGNORE_ERRORS )) -die (_ ("updating files failed" )); - data->add_errors++; - } -break ; -case DIFF_STATUS_DELETED : -if (data->flags &ADD_CACHE_IGNORE_REMOVAL ) -break ; -if (!(data->flags &ADD_CACHE_PRETEND )) -remove_file_from_index (data->index, path); -if (data->flags & (ADD_CACHE_PRETEND |ADD_CACHE_VERBOSE )) -printf (_ ("remove '%s'\n" ), path); -break ; - } - } -} - -int add_files_to_cache (struct repository *repo,const char *prefix, -const struct pathspec *pathspec,int include_sparse, -int flags) -{ -struct update_callback_data data; -struct rev_info rev; - -memset (&data,0 ,sizeof (data)); - data.index = repo->index; - data.include_sparse = include_sparse; - data.flags = flags; - -repo_init_revisions (repo, &rev, prefix); -setup_revisions (0 ,NULL , &rev,NULL ); -if (pathspec) -copy_pathspec (&rev.prune_data, pathspec); - rev.diffopt.output_format =DIFF_FORMAT_CALLBACK ; - rev.diffopt.format_callback = update_callback; - rev.diffopt.format_callback_data = &data; - rev.diffopt.flags.override_submodule_config =1 ; - rev.max_count =0 ;/* do not compare unmerged paths with stage #2 */ - -/* -* Use an ODB transaction to optimize adding multiple objects. -* This function is invoked from commands other than 'add', which -* may not have their own transaction active. -*/ -begin_odb_transaction (); -run_diff_files (&rev,DIFF_RACY_IS_MODIFIED ); -end_odb_transaction (); - -release_revisions (&rev); -return !!data.add_errors; -} -static int renormalize_tracked_files (const struct pathspec *pathspec,int flags) {int i, retval =0 ;
read-cache.c +102 -0
117 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 8/27 statinfo: move stat_{data,validity} functions from cache/read-cache
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
These functions do not depend upon struct cache_entry or struct index_state in any way, and it seems more logical to break them out into this file, especially since statinfo.h already has the struct stat_data declaration.
Diff best viewed with --color-moved.
--- Makefile | 1 + cache.h | 48 ------------------------ object.c | 1 + read-cache.c | 84 ----------------------------------------- refs/packed-backend.c | 1 + shallow.c | 1 + statinfo.c | 87 +++++++++++++++++++++++++++++++++++++++++++ statinfo.h | 51 +++++++++++++++++++++++++ 8 files changed, 142 insertions(+), 132 deletions(-) create mode 100644 statinfo.c
Makefile +1 -0
@@ -1142,6 +1142,7 @@ LIB_OBJS += sigchain.o LIB_OBJS += sparse-index.o LIB_OBJS += split-index.o LIB_OBJS += stable-qsort.o +LIB_OBJS += statinfo.o LIB_OBJS += strbuf.o LIB_OBJS += streaming.o LIB_OBJS += string-list.o
cache.h +0 -48
64 lines not on this page · raw message
object.c +1 -0
@@ -6,6 +6,7 @@#include "object-file.h" #include "object-store.h" #include "blob.h" +#include "statinfo.h" #include "tree.h" #include "commit.h" #include "tag.h"
read-cache.c +0 -84
96 lines not on this page · raw message
refs/packed-backend.c +1 -0
@@ -10,6 +10,7 @@#include "../iterator.h" #include "../lockfile.h" #include "../chdir-notify.h" +#include "../statinfo.h" #include "../wrapper.h" #include "../write-or-die.h"
shallow.c +1 -0
@@ -17,6 +17,7 @@#include "list-objects.h" #include "commit-reach.h" #include "shallow.h" +#include "statinfo.h" #include "trace.h" #include "wrapper.h"
statinfo.c new file +87 -0
87 lines not on this page · raw message
statinfo.h +51 -0
61 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 9/27 run-command.h: move declarations for run-command.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- cache.h | 3 --- exec-cmd.c | 3 ++- run-command.c | 2 +- run-command.h | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-)
cache.h +0 -3
@@ -555,7 +555,4 @@ int checkout_fast_forward(struct repository *r,const struct object_id *to, int overwrite_ignore); - -int sane_execvp (const char *file,char *const argv[]); -#endif /* CACHE_H */
exec-cmd.c +2 -1
@@ -1,10 +1,11 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "environment.h" #include "exec-cmd.h" #include "gettext.h" #include "path.h" #include "quote.h" +#include "run-command.h" #include "strvec.h" #include "trace.h" #include "trace2.h"
run-command.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "run-command.h" #include "environment.h" #include "exec-cmd.h"
run-command.h +2 -0
@@ -564,4 +564,6 @@ enum start_bg_result start_bg_command(struct child_process *cmd,void *cb_data, unsigned int timeout_sec); +int sane_execvp (const char *file,char *const argv[]); +#endif
Signature · 1 line
gitgitgadget
PATCH v2 10/27 name-hash.h: move declarations for name-hash.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- apply.c | 1 + builtin/mv.c | 1 + cache.h | 9 --------- dir.c | 1 + entry.c | 1 + merge-recursive.c | 1 + name-hash.c | 1 + name-hash.h | 16 ++++++++++++++++ read-cache.c | 1 + sparse-index.c | 1 + t/helper/test-lazy-init-name-hash.c | 1 + unpack-trees.c | 1 + 12 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 name-hash.h
apply.c +1 -0
@@ -23,6 +23,7 @@#include "xdiff-interface.h" #include "ll-merge.h" #include "lockfile.h" +#include "name-hash.h" #include "object-name.h" #include "object-file.h" #include "parse-options.h"
builtin/mv.c +1 -0
@@ -11,6 +11,7 @@#include "config.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "object-file.h" #include "pathspec.h" #include "lockfile.h"
cache.h +0 -9
@@ -245,12 +245,6 @@ struct index_state {void index_state_init (struct index_state *istate,struct repository *r);void release_index (struct index_state *istate); -/* Name hashing */ -int test_lazy_init_name_hash (struct index_state *istate,int try_threaded); -void add_name_hash (struct index_state *istate,struct cache_entry *ce); -void remove_name_hash (struct index_state *istate,struct cache_entry *ce); -void free_name_hash (struct index_state *istate); -/* Cache entry creation and cleanup */ /*
@@ -377,9 +371,6 @@ int repo_index_has_changes(struct repository *repo,int verify_path (const char *path,unsigned mode);int strcmp_offset (const char *s1,const char *s2,size_t *first_change); -int index_dir_exists (struct index_state *istate,const char *name,int namelen); -void adjust_dirname_case (struct index_state *istate,char *name); -struct cache_entry *index_file_exists (struct index_state *istate,const char *name,int namelen,int igncase);/* * Searches for an entry defined by name and namelen in the given index.
dir.c +1 -0
@@ -13,6 +13,7 @@#include "dir.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "object-file.h" #include "object-store.h" #include "attr.h"
entry.c +1 -0
@@ -5,6 +5,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "name-hash.h" #include "streaming.h" #include "submodule.h" #include "symlinks.h"
merge-recursive.c +1 -0
@@ -23,6 +23,7 @@#include "ll-merge.h" #include "lockfile.h" #include "match-trees.h" +#include "name-hash.h" #include "object-file.h" #include "object-name.h" #include "object-store.h"
name-hash.c +1 -0
@@ -8,6 +8,7 @@#include "cache.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "thread-utils.h" #include "trace.h" #include "trace2.h"
name-hash.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef NAME_HASH_H +#define NAME_HASH_H + +struct cache_entry ; +struct index_state ; + +int index_dir_exists (struct index_state *istate,const char *name,int namelen); +void adjust_dirname_case (struct index_state *istate,char *name); +struct cache_entry *index_file_exists (struct index_state *istate,const char *name,int namelen,int igncase); + +int test_lazy_init_name_hash (struct index_state *istate,int try_threaded); +void add_name_hash (struct index_state *istate,struct cache_entry *ce); +void remove_name_hash (struct index_state *istate,struct cache_entry *ce); +void free_name_hash (struct index_state *istate); + +#endif /* NAME_HASH_H */
read-cache.c +1 -0
@@ -25,6 +25,7 @@#include "environment.h" #include "gettext.h" #include "mem-pool.h" +#include "name-hash.h" #include "object-name.h" #include "resolve-undo.h" #include "revision.h"
sparse-index.c +1 -0
@@ -2,6 +2,7 @@#include "alloc.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "repository.h" #include "sparse-index.h" #include "tree.h"
t/helper/test-lazy-init-name-hash.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "environment.h" +#include "name-hash.h" #include "parse-options.h" #include "repository.h" #include "setup.h"
unpack-trees.c +1 -0
@@ -7,6 +7,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "name-hash.h" #include "tree.h" #include "tree-walk.h" #include "cache-tree.h"
Signature · 1 line
gitgitgadget
PATCH v2 11/27 sparse-index.h: move declarations for sparse-index.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
Note in particular that this reverses the decision made in 118a2e8bde0 ("cache: move ensure_full_index() to cache.h", 2021-04-01).
--- builtin/checkout-index.c | 1 + builtin/commit.c | 1 + builtin/difftool.c | 1 + builtin/fsck.c | 1 + builtin/ls-files.c | 1 + builtin/merge-index.c | 1 + builtin/read-tree.c | 1 + builtin/reset.c | 1 + builtin/rm.c | 1 + builtin/stash.c | 1 + builtin/submodule--helper.c | 1 + builtin/update-index.c | 1 + cache.h | 2 -- dir.c | 1 + entry.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + resolve-undo.c | 1 + revision.c | 1 + sequencer.c | 1 + sparse-index.h | 2 ++ 21 files changed, 21 insertions(+), 2 deletions(-)
builtin/checkout-index.c +1 -0
@@ -17,6 +17,7 @@#include "entry.h" #include "parallel-checkout.h" #include "setup.h" +#include "sparse-index.h" #define CHECKOUT_ALL 4static int nul_term_line;
builtin/commit.c +1 -0
@@ -38,6 +38,7 @@#include "gpg-interface.h" #include "column.h" #include "sequencer.h" +#include "sparse-index.h" #include "mailmap.h" #include "help.h" #include "commit-reach.h"
builtin/difftool.c +1 -0
@@ -23,6 +23,7 @@#include "gettext.h" #include "hex.h" #include "parse-options.h" +#include "sparse-index.h" #include "strvec.h" #include "strbuf.h" #include "lockfile.h"
builtin/fsck.c +1 -0
@@ -25,6 +25,7 @@#include "replace-object.h" #include "resolve-undo.h" #include "run-command.h" +#include "sparse-index.h" #include "worktree.h" #include "pack-revindex.h"
builtin/ls-files.c +1 -0
@@ -23,6 +23,7 @@#include "pathspec.h" #include "run-command.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h"
builtin/merge-index.c +1 -0
@@ -3,6 +3,7 @@#include "hex.h" #include "repository.h" #include "run-command.h" +#include "sparse-index.h" static const char *pgm;static int one_shot, quiet;
builtin/read-tree.c +1 -0
@@ -22,6 +22,7 @@#include "repository.h" #include "resolve-undo.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h"
builtin/reset.c +1 -0
@@ -29,6 +29,7 @@#include "unpack-trees.h" #include "cache-tree.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h" #include "trace.h"
builtin/rm.c +1 -0
@@ -19,6 +19,7 @@#include "repository.h" #include "string-list.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "pathspec.h"
builtin/stash.c +1 -0
@@ -20,6 +20,7 @@#include "rerere.h" #include "revision.h" #include "setup.h" +#include "sparse-index.h" #include "log-tree.h" #include "diffcore.h" #include "exec-cmd.h"
builtin/submodule--helper.c +1 -0
@@ -13,6 +13,7 @@#include "pathspec.h" #include "dir.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h" #include "string-list.h"
builtin/update-index.c +1 -0
@@ -24,6 +24,7 @@#include "dir.h" #include "repository.h" #include "setup.h" +#include "sparse-index.h" #include "split-index.h" #include "symlinks.h" #include "fsmonitor.h"
cache.h +0 -2
@@ -327,8 +327,6 @@ int read_index_from(struct index_state *, const char *path, const char *gitdir);int is_index_unborn (struct index_state *); -void ensure_full_index (struct index_state *istate); -/* For use with `write_locked_index()`. */ #define COMMIT_LOCK (1 << 0)#define SKIP_IF_UNCHANGED (1 << 1)
dir.c +1 -0
@@ -25,6 +25,7 @@#include "ewah/ewok.h" #include "fsmonitor.h" #include "setup.h" +#include "sparse-index.h" #include "submodule-config.h" #include "symlinks.h" #include "trace2.h"
entry.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "hex.h" #include "name-hash.h" +#include "sparse-index.h" #include "streaming.h" #include "submodule.h" #include "symlinks.h"
merge-ort.c +1 -0
@@ -38,6 +38,7 @@#include "oid-array.h" #include "promisor-remote.h" #include "revision.h" +#include "sparse-index.h" #include "strmap.h" #include "submodule-config.h" #include "submodule.h"
merge-recursive.c +1 -0
@@ -29,6 +29,7 @@#include "object-store.h" #include "repository.h" #include "revision.h" +#include "sparse-index.h" #include "string-list.h" #include "submodule-config.h" #include "submodule.h"
resolve-undo.c +1 -0
@@ -2,6 +2,7 @@#include "dir.h" #include "hash.h" #include "resolve-undo.h" +#include "sparse-index.h" #include "string-list.h" /* The only error case is to run out of memory in string-list */
revision.c +1 -0
@@ -32,6 +32,7 @@#include "packfile.h" #include "worktree.h" #include "setup.h" +#include "sparse-index.h" #include "strvec.h" #include "trace2.h" #include "commit-reach.h"
sequencer.c +1 -0
@@ -28,6 +28,7 @@#include "merge-ort.h" #include "merge-ort-wrappers.h" #include "refs.h" +#include "sparse-index.h" #include "strvec.h" #include "quote.h" #include "trailer.h"
sparse-index.h +2 -0
@@ -37,4 +37,6 @@ struct pattern_list;*/ void expand_index (struct index_state *istate,struct pattern_list *pl); +void ensure_full_index (struct index_state *istate); +#endif
Signature · 1 line
gitgitgadget
PATCH v2 12/27 preload-index.h: move declarations for preload-index.c from elsewhere
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
We already have a preload-index.c file; move the declarations for the functions in that file into a new preload-index.h. These were previously split between cache.h and repository.h.
--- add-interactive.c | 1 + builtin/add.c | 1 + builtin/am.c | 1 + builtin/checkout.c | 1 + builtin/commit.c | 1 + builtin/diff-files.c | 1 + builtin/diff-index.c | 1 + builtin/diff.c | 1 + builtin/stash.c | 1 + builtin/submodule--helper.c | 1 + cache.h | 3 --- preload-index.c | 1 + preload-index.h | 15 +++++++++++++++ read-cache.c | 1 + repository.h | 3 --- 15 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 preload-index.h
add-interactive.c +1 -0
@@ -5,6 +5,7 @@#include "diffcore.h" #include "gettext.h" #include "hex.h" +#include "preload-index.h" #include "revision.h" #include "refs.h" #include "string-list.h"
builtin/add.c +1 -0
@@ -17,6 +17,7 @@#include "cache-tree.h" #include "run-command.h" #include "parse-options.h" +#include "preload-index.h" #include "diff.h" #include "diffcore.h" #include "revision.h"
builtin/am.c +1 -0
@@ -29,6 +29,7 @@#include "unpack-trees.h" #include "branch.h" #include "object-name.h" +#include "preload-index.h" #include "sequencer.h" #include "revision.h" #include "merge-recursive.h"
builtin/checkout.c +1 -0
@@ -20,6 +20,7 @@#include "object-name.h" #include "object-store.h" #include "parse-options.h" +#include "preload-index.h" #include "refs.h" #include "remote.h" #include "resolve-undo.h"
builtin/commit.c +1 -0
@@ -30,6 +30,7 @@#include "utf8.h" #include "object-name.h" #include "parse-options.h" +#include "preload-index.h" #include "string-list.h" #include "rerere.h" #include "unpack-trees.h"
builtin/diff-files.c +1 -0
@@ -8,6 +8,7 @@#include "diff.h" #include "diff-merges.h" #include "commit.h" +#include "preload-index.h" #include "revision.h" #include "builtin.h" #include "submodule.h"
builtin/diff-index.c +1 -0
@@ -3,6 +3,7 @@#include "diff.h" #include "diff-merges.h" #include "commit.h" +#include "preload-index.h" #include "revision.h" #include "builtin.h" #include "setup.h"
builtin/diff.c +1 -0
@@ -16,6 +16,7 @@#include "diff.h" #include "diff-merges.h" #include "diffcore.h" +#include "preload-index.h" #include "revision.h" #include "log-tree.h" #include "builtin.h"
builtin/stash.c +1 -0
@@ -17,6 +17,7 @@#include "run-command.h" #include "dir.h" #include "entry.h" +#include "preload-index.h" #include "rerere.h" #include "revision.h" #include "setup.h"
builtin/submodule--helper.c +1 -0
@@ -11,6 +11,7 @@#include "parse-options.h" #include "quote.h" #include "pathspec.h" +#include "preload-index.h" #include "dir.h" #include "setup.h" #include "sparse-index.h"
cache.h +0 -3
@@ -318,9 +318,6 @@ extern struct index_state the_index;/* Initialize and use the cache information */ struct lock_file ; -void preload_index (struct index_state *index, -const struct pathspec *pathspec, -unsigned int refresh_flags);int do_read_index (struct index_state *istate,const char *path,int must_exist);/* for testting only! */ int read_index_from(struct index_state *, const char *path,
preload-index.c +1 -0
@@ -8,6 +8,7 @@#include "fsmonitor.h" #include "gettext.h" #include "config.h" +#include "preload-index.h" #include "progress.h" #include "thread-utils.h" #include "repository.h"
preload-index.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef PRELOAD_INDEX_H +#define PRELOAD_INDEX_H + +struct index_state ; +struct pathspec ; +struct repository ; + +void preload_index (struct index_state *index, +const struct pathspec *pathspec, +unsigned int refresh_flags); +int repo_read_index_preload (struct repository *, +const struct pathspec *pathspec, +unsigned refresh_flags); + +#endif /* PRELOAD_INDEX_H */
read-cache.c +1 -0
@@ -27,6 +27,7 @@#include "mem-pool.h" #include "name-hash.h" #include "object-name.h" +#include "preload-index.h" #include "resolve-undo.h" #include "revision.h" #include "run-command.h"
repository.h +0 -3
@@ -220,9 +220,6 @@ int repo_hold_locked_index(struct repository *repo,struct lock_file *lf, int flags); -int repo_read_index_preload (struct repository *, -const struct pathspec *pathspec, -unsigned refresh_flags);int repo_read_index_unmerged (struct repository *);/* * Opportunistically update the index but do not complain if we can't.
Signature · 1 line
gitgitgadget
PATCH v2 13/27 diff.h: move declaration for global in diff.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- cache.h | 3 --- diff.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-)
cache.h +0 -3
@@ -523,9 +523,6 @@ int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, int include_sparse, int flags); -/* diff.c */ -extern int diff_auto_refresh_index; -/* ls-files */ void overlay_tree_on_index (struct index_state *istate,const char *tree_name,const char *prefix);
diff.h +2 -0
@@ -694,4 +694,6 @@ void print_stat_summary(FILE *fp, int files, int insertions, int deletions);void setup_diff_pager (struct diff_options *); +extern int diff_auto_refresh_index; +#endif /* DIFF_H */
Signature · 1 line
gitgitgadget
PATCH v2 14/27 merge.h: move declarations for merge.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- builtin/merge.c | 1 + builtin/pull.c | 1 + cache.h | 11 ----------- merge.c | 1 + merge.h | 17 +++++++++++++++++ sequencer.c | 1 + 6 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 merge.h
builtin/merge.c +1 -0
@@ -37,6 +37,7 @@#include "color.h" #include "rerere.h" #include "help.h" +#include "merge.h" #include "merge-recursive.h" #include "merge-ort-wrappers.h" #include "resolve-undo.h"
builtin/pull.c +1 -0
@@ -12,6 +12,7 @@#include "builtin.h" #include "gettext.h" #include "hex.h" +#include "merge.h" #include "object-name.h" #include "parse-options.h" #include "exec-cmd.h"
cache.h +0 -11
@@ -527,15 +527,4 @@ int add_files_to_cache(struct repository *repo, const char *prefix,void overlay_tree_on_index (struct index_state *istate,const char *tree_name,const char *prefix); -/* merge.c */ -struct commit_list ; -int try_merge_command (struct repository *r, -const char *strategy,size_t xopts_nr, -const char **xopts,struct commit_list *common, -const char *head_arg,struct commit_list *remotes); -int checkout_fast_forward (struct repository *r, -const struct object_id *from, -const struct object_id *to, -int overwrite_ignore); -#endif /* CACHE_H */
merge.c +1 -0
@@ -4,6 +4,7 @@#include "gettext.h" #include "hex.h" #include "lockfile.h" +#include "merge.h" #include "commit.h" #include "run-command.h" #include "resolve-undo.h"
merge.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef MERGE_H +#define MERGE_H + +struct commit_list ; +struct object_id ; +struct repository ; + +int try_merge_command (struct repository *r, +const char *strategy,size_t xopts_nr, +const char **xopts,struct commit_list *common, +const char *head_arg,struct commit_list *remotes); +int checkout_fast_forward (struct repository *r, +const struct object_id *from, +const struct object_id *to, +int overwrite_ignore); + +#endif /* MERGE_H */
sequencer.c +1 -0
@@ -25,6 +25,7 @@#include "diff.h" #include "revision.h" #include "rerere.h" +#include "merge.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" #include "refs.h"
Signature · 1 line
gitgitgadget
PATCH v2 15/27 repository.h: move declaration of the_index from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
the_index is a global variable defined in repository.c; as such, its declaration feels better suited living in repository.h rather than cache.h. Move it.
--- cache.h | 4 ---- repository.h | 3 +++ t/helper/test-dump-split-index.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-)
cache.h +0 -4
@@ -312,10 +312,6 @@ typedef int (*must_prefetch_predicate)(const struct cache_entry *);void prefetch_cache_entries (const struct index_state *istate,must_prefetch_predicate must_prefetch); -#ifdef USE_THE_INDEX_VARIABLE -extern struct index_state the_index; -#endif -/* Initialize and use the cache information */ struct lock_file ; int do_read_index(struct index_state *istate, const char *path,
repository.h +3 -0
@@ -169,6 +169,9 @@ struct repository { };extern struct repository *the_repository; +#ifdef USE_THE_INDEX_VARIABLE +extern struct index_state the_index; +#endif /* * Define a custom repository layout. Any field can be NULL, which
t/helper/test-dump-split-index.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "hex.h" +#include "repository.h" #include "setup.h" #include "split-index.h" #include "ewah/ewok.h"
Signature · 1 line
gitgitgadget
Re: [PATCH v2 15/27] repository.h: move declaration of the_index from cache.h
Quoted 7 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
the_indexis a global variable defined inrepository.c; as such, its declaration feels better suited living inrepository.hrather thancache.h. Move it.Signed-off-by Elijah Newren <[email protected]>
Up to here looks good. Now to look at the read-cache-ll/read-cache split in patch 16...
PATCH v2 16/27 read-cache*.h: move declarations for read-cache.c functions from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
For the functions defined in read-cache.c, move their declarations from cache.h to a new header, read-cache-ll.h. Also move some related inline functions from cache.h to read-cache.h. The purpose of the read-cache-ll.h/read-cache.h split is that about 70% of the sites don't need the inline functions and the extra headers they include.
--- add-interactive.c | 1 + add-patch.c | 1 + apply.c | 1 + attr.c | 1 + blame.c | 1 + builtin/add.c | 1 + builtin/checkout--worker.c | 1 + builtin/checkout-index.c | 1 + builtin/checkout.c | 1 + builtin/clean.c | 1 + builtin/commit.c | 1 + builtin/describe.c | 1 + builtin/diff-tree.c | 1 + builtin/diff.c | 1 + builtin/difftool.c | 1 + builtin/fsck.c | 1 + builtin/grep.c | 1 + builtin/ls-files.c | 1 + builtin/merge-index.c | 1 + builtin/mv.c | 1 + builtin/pull.c | 1 + builtin/rev-parse.c | 1 + builtin/rm.c | 1 + builtin/stash.c | 1 + builtin/submodule--helper.c | 1 + builtin/update-index.c | 1 + builtin/worktree.c | 1 + cache-tree.c | 1 + cache.h | 520 --------------------------- compat/precompose_utf8.c | 1 + compat/sha1-chunked.c | 1 + config.c | 1 + convert.c | 1 + diff-lib.c | 1 + diff.c | 1 + diffcore-break.c | 3 +- environment.h | 3 +- fsmonitor.h | 2 + git.c | 1 + hash-lookup.c | 1 + merge-ort-wrappers.c | 1 + merge-ort.c | 1 + name-hash.c | 2 + object-name.c | 1 + oidmap.h | 1 + parallel-checkout.c | 1 + pathspec.c | 1 + preload-index.c | 1 + read-cache-ll.h | 481 +++++++++++++++++++++++++ read-cache.c | 1 + read-cache.h | 45 +++ repository.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + split-index.c | 1 + submodule.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-dump-cache-tree.c | 1 + t/helper/test-dump-fsmonitor.c | 1 + t/helper/test-dump-split-index.c | 1 + t/helper/test-dump-untracked-cache.c | 1 + t/helper/test-fast-rebase.c | 1 + t/helper/test-fsmonitor-client.c | 1 + t/helper/test-hash-speed.c | 1 + t/helper/test-index-version.c | 1 + t/helper/test-lazy-init-name-hash.c | 1 + t/helper/test-path-utils.c | 1 + t/helper/test-read-cache.c | 1 + t/helper/test-scrap-cache-tree.c | 1 + t/helper/test-sha1.c | 1 + t/helper/test-sha256.c | 1 + t/helper/test-strcmp-offset.c | 1 + t/helper/test-write-cache.c | 1 + unpack-trees.c | 1 + unpack-trees.h | 2 +- wt-status.c | 1 + 77 files changed, 603 insertions(+), 524 deletions(-) create mode 100644 read-cache-ll.h create mode 100644 read-cache.h
add-interactive.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "hex.h" #include "preload-index.h" +#include "read-cache-ll.h" #include "revision.h" #include "refs.h" #include "string-list.h"
add-patch.c +1 -0
@@ -6,6 +6,7 @@#include "environment.h" #include "gettext.h" #include "object-name.h" +#include "read-cache-ll.h" #include "strbuf.h" #include "run-command.h" #include "strvec.h"
apply.c +1 -0
@@ -28,6 +28,7 @@#include "object-file.h" #include "parse-options.h" #include "quote.h" +#include "read-cache.h" #include "rerere.h" #include "apply.h" #include "entry.h"
attr.c +1 -0
@@ -16,6 +16,7 @@#include "gettext.h" #include "utf8.h" #include "quote.h" +#include "read-cache-ll.h" #include "revision.h" #include "object-store.h" #include "setup.h"
blame.c +1 -0
@@ -8,6 +8,7 @@#include "diffcore.h" #include "gettext.h" #include "hex.h" +#include "read-cache.h" #include "setup.h" #include "tag.h" #include "trace2.h"
builtin/add.c +1 -0
@@ -20,6 +20,7 @@#include "preload-index.h" #include "diff.h" #include "diffcore.h" +#include "read-cache.h" #include "revision.h" #include "bulk-checkin.h" #include "strvec.h"
builtin/checkout--worker.c +1 -0
@@ -6,6 +6,7 @@#include "parallel-checkout.h" #include "parse-options.h" #include "pkt-line.h" +#include "read-cache-ll.h" static void packet_to_pc_item (const char *buffer,int len,struct parallel_checkout_item *pc_item)
builtin/checkout-index.c +1 -0
@@ -16,6 +16,7 @@#include "parse-options.h" #include "entry.h" #include "parallel-checkout.h" +#include "read-cache-ll.h" #include "setup.h" #include "sparse-index.h"
builtin/checkout.c +1 -0
@@ -21,6 +21,7 @@#include "object-store.h" #include "parse-options.h" #include "preload-index.h" +#include "read-cache.h" #include "refs.h" #include "remote.h" #include "resolve-undo.h"
builtin/clean.c +1 -0
@@ -14,6 +14,7 @@#include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "string-list.h"
builtin/commit.c +1 -0
@@ -31,6 +31,7 @@#include "object-name.h" #include "parse-options.h" #include "preload-index.h" +#include "read-cache.h" #include "string-list.h" #include "rerere.h" #include "unpack-trees.h"
builtin/describe.c +1 -0
@@ -13,6 +13,7 @@#include "exec-cmd.h" #include "object-name.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "revision.h" #include "diff.h" #include "hashmap.h"
builtin/diff-tree.c +1 -0
@@ -8,6 +8,7 @@#include "log-tree.h" #include "builtin.h" #include "submodule.h" +#include "read-cache-ll.h" #include "repository.h" #include "tree.h"
builtin/diff.c +1 -0
@@ -17,6 +17,7 @@#include "diff-merges.h" #include "diffcore.h" #include "preload-index.h" +#include "read-cache-ll.h" #include "revision.h" #include "log-tree.h" #include "builtin.h"
builtin/difftool.c +1 -0
@@ -23,6 +23,7 @@#include "gettext.h" #include "hex.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "sparse-index.h" #include "strvec.h" #include "strbuf.h"
builtin/fsck.c +1 -0
@@ -22,6 +22,7 @@#include "object-file.h" #include "object-name.h" #include "object-store.h" +#include "read-cache-ll.h" #include "replace-object.h" #include "resolve-undo.h" #include "run-command.h"
builtin/grep.c +1 -0
@@ -31,6 +31,7 @@#include "object-store.h" #include "packfile.h" #include "pager.h" +#include "read-cache-ll.h" #include "write-or-die.h" static const char *grep_prefix;
builtin/ls-files.c +1 -0
@@ -21,6 +21,7 @@#include "resolve-undo.h" #include "string-list.h" #include "pathspec.h" +#include "read-cache.h" #include "run-command.h" #include "setup.h" #include "sparse-index.h"
builtin/merge-index.c +1 -0
@@ -1,6 +1,7 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "hex.h" +#include "read-cache-ll.h" #include "repository.h" #include "run-command.h" #include "sparse-index.h"
builtin/mv.c +1 -0
@@ -19,6 +19,7 @@#include "cache-tree.h" #include "string-list.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "submodule.h"
builtin/pull.c +1 -0
@@ -20,6 +20,7 @@#include "oid-array.h" #include "remote.h" #include "dir.h" +#include "read-cache-ll.h" #include "rebase.h" #include "refs.h" #include "refspec.h"
builtin/rev-parse.c +1 -0
@@ -18,6 +18,7 @@#include "object-name.h" #include "parse-options.h" #include "diff.h" +#include "read-cache-ll.h" #include "revision.h" #include "setup.h" #include "split-index.h"
builtin/rm.c +1 -0
@@ -16,6 +16,7 @@#include "tree-walk.h" #include "object-name.h" #include "parse-options.h" +#include "read-cache.h" #include "repository.h" #include "string-list.h" #include "setup.h"
builtin/stash.c +1 -0
@@ -18,6 +18,7 @@#include "dir.h" #include "entry.h" #include "preload-index.h" +#include "read-cache.h" #include "rerere.h" #include "revision.h" #include "setup.h"
builtin/submodule--helper.c +1 -0
@@ -13,6 +13,7 @@#include "pathspec.h" #include "preload-index.h" #include "dir.h" +#include "read-cache.h" #include "setup.h" #include "sparse-index.h" #include "submodule.h"
builtin/update-index.c +1 -0
@@ -22,6 +22,7 @@#include "parse-options.h" #include "pathspec.h" #include "dir.h" +#include "read-cache.h" #include "repository.h" #include "setup.h" #include "sparse-index.h"
builtin/worktree.c +1 -0
@@ -13,6 +13,7 @@#include "parse-options.h" #include "strvec.h" #include "branch.h" +#include "read-cache-ll.h" #include "refs.h" #include "repository.h" #include "run-command.h"
cache-tree.c +1 -0
@@ -9,6 +9,7 @@#include "bulk-checkin.h" #include "object-file.h" #include "object-store.h" +#include "read-cache-ll.h" #include "replace-object.h" #include "promisor-remote.h" #include "sparse-index.h"
cache.h +0 -520
525 lines not on this page · raw message
compat/precompose_utf8.c +1 -0
@@ -10,6 +10,7 @@#include "environment.h" #include "gettext.h" #include "path.h" +#include "strbuf.h" #include "utf8.h" #include "precompose_utf8.h"
compat/sha1-chunked.c +1 -0
@@ -1,4 +1,5 @@#include "cache.h" +#include "hash-ll.h" int git_SHA1_Update_Chunked (platform_SHA_CTX *c,const void *data,size_t len) {
config.c +1 -0
@@ -33,6 +33,7 @@#include "replace-object.h" #include "refs.h" #include "setup.h" +#include "strvec.h" #include "trace2.h" #include "worktree.h" #include "ws.h"
convert.c +1 -0
@@ -9,6 +9,7 @@#include "attr.h" #include "run-command.h" #include "quote.h" +#include "read-cache-ll.h" #include "sigchain.h" #include "pkt-line.h" #include "sub-process.h"
diff-lib.c +1 -0
@@ -9,6 +9,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" +#include "read-cache.h" #include "revision.h" #include "cache-tree.h" #include "unpack-trees.h"
diff.c +1 -0
@@ -39,6 +39,7 @@#include "dir.h" #include "object-file.h" #include "object-name.h" +#include "read-cache-ll.h" #include "setup.h" #include "strmap.h" #include "ws.h"
diffcore-break.c +2 -1
@@ -1,9 +1,10 @@/* * Copyright (C) 2005 Junio C Hamano */ -#include "cache.h" +#include "git-compat-util.h" #include "diff.h" #include "diffcore.h" +#include "object.h" #include "promisor-remote.h" static int should_break(struct repository *r,
environment.h +1 -2
@@ -1,9 +1,8 @@#ifndef ENVIRONMENT_H #define ENVIRONMENT_H -#include "strvec.h" -struct repository ; +struct strvec ;/* * The character that begins a commented line in user-editable file
fsmonitor.h +2 -0
@@ -4,6 +4,8 @@#include "cache.h" #include "dir.h" #include "fsmonitor-settings.h" +#include "object.h" +#include "read-cache-ll.h" #include "trace.h" extern struct trace_key trace_fsmonitor;
git.c +1 -0
@@ -5,6 +5,7 @@#include "gettext.h" #include "help.h" #include "pager.h" +#include "read-cache-ll.h" #include "run-command.h" #include "alias.h" #include "replace-object.h"
hash-lookup.c +1 -0
@@ -1,6 +1,7 @@#include "cache.h" #include "hash.h" #include "hash-lookup.h" +#include "read-cache-ll.h" static uint32_t take2 (const struct object_id *oid,size_t ofs) {
merge-ort-wrappers.c +1 -0
@@ -3,6 +3,7 @@#include "hash.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" +#include "read-cache-ll.h" #include "tree.h" #include "commit.h"
merge-ort.c +1 -0
@@ -37,6 +37,7 @@#include "object-store.h" #include "oid-array.h" #include "promisor-remote.h" +#include "read-cache-ll.h" #include "revision.h" #include "sparse-index.h" #include "strmap.h"
name-hash.c +2 -0
@@ -9,6 +9,8 @@#include "environment.h" #include "gettext.h" #include "name-hash.h" +#include "object.h" +#include "read-cache-ll.h" #include "thread-utils.h" #include "trace.h" #include "trace2.h"
object-name.c +1 -0
@@ -18,6 +18,7 @@#include "packfile.h" #include "pretty.h" #include "object-store.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "submodule.h"
oidmap.h +1 -0
@@ -1,6 +1,7 @@#ifndef OIDMAP_H #define OIDMAP_H +#include "hash-ll.h" #include "hashmap.h" /*
parallel-checkout.c +1 -0
@@ -8,6 +8,7 @@#include "parallel-checkout.h" #include "pkt-line.h" #include "progress.h" +#include "read-cache-ll.h" #include "run-command.h" #include "sigchain.h" #include "streaming.h"
pathspec.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "pathspec.h" #include "attr.h" +#include "read-cache.h" #include "repository.h" #include "setup.h" #include "strvec.h"
preload-index.c +1 -0
@@ -10,6 +10,7 @@#include "config.h" #include "preload-index.h" #include "progress.h" +#include "read-cache.h" #include "thread-utils.h" #include "repository.h" #include "symlinks.h"
read-cache-ll.h new file +481 -0
481 lines not on this page · raw message
read-cache.c +1 -0
@@ -28,6 +28,7 @@#include "name-hash.h" #include "object-name.h" #include "preload-index.h" +#include "read-cache.h" #include "resolve-undo.h" #include "revision.h" #include "run-command.h"
read-cache.h new file +45 -0
45 lines not on this page · raw message
repository.c +1 -0
@@ -10,6 +10,7 @@#include "config.h" #include "object.h" #include "lockfile.h" +#include "read-cache-ll.h" #include "remote.h" #include "setup.h" #include "submodule-config.h"
rerere.c +1 -0
@@ -7,6 +7,7 @@#include "hex.h" #include "lockfile.h" #include "string-list.h" +#include "read-cache-ll.h" #include "rerere.h" #include "xdiff-interface.h" #include "dir.h"
resolve-undo.c +1 -0
@@ -1,6 +1,7 @@#include "cache.h" #include "dir.h" #include "hash.h" +#include "read-cache.h" #include "resolve-undo.h" #include "sparse-index.h" #include "string-list.h"
revision.c +1 -0
@@ -31,6 +31,7 @@#include "bisect.h" #include "packfile.h" #include "worktree.h" +#include "read-cache.h" #include "setup.h" #include "sparse-index.h" #include "strvec.h"
split-index.c +1 -0
@@ -3,6 +3,7 @@#include "gettext.h" #include "hash.h" #include "mem-pool.h" +#include "read-cache-ll.h" #include "split-index.h" #include "strbuf.h" #include "ewah/ewok.h"
submodule.c +1 -0
@@ -28,6 +28,7 @@#include "object-name.h" #include "object-store.h" #include "commit-reach.h" +#include "read-cache-ll.h" #include "setup.h" #include "shallow.h" #include "trace2.h"
t/helper/test-cache-tree.c +1 -0
@@ -6,6 +6,7 @@#include "tree.h" #include "cache-tree.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h"
t/helper/test-dump-cache-tree.c +1 -0
@@ -5,6 +5,7 @@#include "hex.h" #include "tree.h" #include "cache-tree.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h"
t/helper/test-dump-fsmonitor.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h"
t/helper/test-dump-split-index.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "hex.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "split-index.h"
t/helper/test-dump-untracked-cache.c +1 -0
@@ -3,6 +3,7 @@#include "cache.h" #include "dir.h" #include "hex.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h"
t/helper/test-fast-rebase.c +1 -0
@@ -21,6 +21,7 @@#include "lockfile.h" #include "merge-ort.h" #include "object-name.h" +#include "read-cache-ll.h" #include "refs.h" #include "revision.h" #include "sequencer.h"
t/helper/test-fsmonitor-client.c +1 -0
@@ -7,6 +7,7 @@#include "cache.h" #include "parse-options.h" #include "fsmonitor-ipc.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "thread-utils.h"
t/helper/test-hash-speed.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "hash-ll.h" #define NUM_SECONDS 3
t/helper/test-index-version.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "read-cache-ll.h" int cmd__index_version(int argc UNUSED, const char **argv UNUSED) {
t/helper/test-lazy-init-name-hash.c +1 -0
@@ -4,6 +4,7 @@#include "environment.h" #include "name-hash.h" #include "parse-options.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "trace.h"
t/helper/test-path-utils.c +1 -0
@@ -3,6 +3,7 @@#include "abspath.h" #include "environment.h" #include "path.h" +#include "read-cache-ll.h" #include "setup.h" #include "string-list.h" #include "trace.h"
t/helper/test-read-cache.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "config.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "wrapper.h"
t/helper/test-scrap-cache-tree.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h" #include "tree.h"
t/helper/test-sha1.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "hash-ll.h" int cmd__sha1 (int ac,const char **av) {
t/helper/test-sha256.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "hash-ll.h" int cmd__sha256 (int ac,const char **av) {
t/helper/test-strcmp-offset.c +1 -0
@@ -1,5 +1,6 @@#include "test-tool.h" #include "cache.h" +#include "read-cache-ll.h" int cmd__strcmp_offset(int argc UNUSED, const char **argv) {
t/helper/test-write-cache.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "read-cache-ll.h" #include "repository.h" #include "setup.h"
unpack-trees.c +1 -0
@@ -15,6 +15,7 @@#include "progress.h" #include "refs.h" #include "attr.h" +#include "read-cache.h" #include "split-index.h" #include "sparse-index.h" #include "submodule.h"
unpack-trees.h +1 -1
@@ -1,8 +1,8 @@#ifndef UNPACK_TREES_H #define UNPACK_TREES_H -#include "cache.h" #include "convert.h" +#include "read-cache-ll.h" #include "strvec.h" #include "string-list.h" #include "tree-walk.h"
wt-status.c +1 -0
@@ -18,6 +18,7 @@#include "refs.h" #include "submodule.h" #include "column.h" +#include "read-cache.h" #include "setup.h" #include "strbuf.h" #include "trace.h"
Signature · 1 line
gitgitgadget
Re: [PATCH v2 16/27] read-cache*.h: move declarations for read-cache.c functions from cache.h
Quoted 7 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
For the functions defined in
read-cache.c, move their declarations fromcache.hto a new header,read-cache-ll.h. Also move some related inline functions fromcache.htoread-cache.h. The purpose of theread-cache-ll.h/read-cache.hsplit is that about 70% of the sites don't need the inline functions and the extra headers they include.
Ah, the 70% is not something I would have expected, but since this is the case, the split into -ll and without makes sense. Up to here looks good.
PATCH v2 17/27 cache.h: remove this no-longer-used header
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
Since this header showed up in some places besides just #include statements, update/clean-up/remove those other places as well.
Note that compat/fsmonitor/fsm-path-utils-darwin.c previously got away with violating the rule that all files must start with an include of git-compat-util.h (or a short-list of alternate headers that happen to include it first). This change exposed the violation and caused it to stop building correctly; fix it by having it include git-compat-util.h first, as per policy.
--- Documentation/CodingGuidelines | 2 +- Documentation/MyFirstObjectWalk.txt | 2 +- Documentation/user-manual.txt | 18 ++++++++---------- Makefile | 2 +- add-interactive.c | 2 +- add-patch.c | 2 +- apply.c | 2 +- attr.c | 2 +- blame.c | 2 +- builtin.h | 1 - builtin/add.c | 3 +-- builtin/am.c | 3 +-- builtin/apply.c | 1 - builtin/archive.c | 1 - builtin/bisect.c | 1 - builtin/branch.c | 3 +-- builtin/bundle.c | 1 - builtin/cat-file.c | 3 +-- builtin/check-attr.c | 1 - builtin/check-ignore.c | 1 - builtin/check-ref-format.c | 3 +-- builtin/clean.c | 1 - builtin/column.c | 1 - builtin/commit-tree.c | 3 +-- builtin/commit.c | 3 +-- builtin/count-objects.c | 3 +-- builtin/describe.c | 3 +-- builtin/diff-files.c | 3 +-- builtin/diff-index.c | 3 +-- builtin/diff-tree.c | 3 +-- builtin/diff.c | 3 +-- builtin/difftool.c | 3 +-- builtin/fast-export.c | 1 - builtin/fast-import.c | 1 - builtin/fetch.c | 3 +-- builtin/for-each-ref.c | 1 - builtin/for-each-repo.c | 3 +-- builtin/fsck.c | 1 - builtin/get-tar-commit-id.c | 3 +-- builtin/grep.c | 3 +-- builtin/help.c | 3 +-- builtin/hook.c | 1 - builtin/init-db.c | 3 +-- builtin/interpret-trailers.c | 1 - builtin/ls-files.c | 3 +-- builtin/ls-remote.c | 1 - builtin/ls-tree.c | 3 +-- builtin/mailinfo.c | 3 +-- builtin/mailsplit.c | 1 - builtin/merge-base.c | 1 - builtin/merge-file.c | 1 - builtin/merge-recursive.c | 1 - builtin/merge.c | 3 +-- builtin/multi-pack-index.c | 1 - builtin/notes.c | 3 +-- builtin/patch-id.c | 1 - builtin/prune.c | 3 +-- builtin/pull.c | 3 +-- builtin/push.c | 3 +-- builtin/range-diff.c | 1 - builtin/read-tree.c | 3 +-- builtin/replace.c | 3 +-- builtin/rerere.c | 1 - builtin/rev-list.c | 3 +-- builtin/rev-parse.c | 3 +-- builtin/shortlog.c | 1 - builtin/show-branch.c | 3 +-- builtin/show-index.c | 1 - builtin/show-ref.c | 1 - builtin/sparse-checkout.c | 1 - builtin/stripspace.c | 1 - builtin/submodule--helper.c | 1 - builtin/symbolic-ref.c | 1 - builtin/tag.c | 3 +-- builtin/unpack-objects.c | 1 - builtin/update-index.c | 3 +-- builtin/update-ref.c | 3 +-- builtin/update-server-info.c | 3 +-- builtin/upload-archive.c | 1 - builtin/upload-pack.c | 1 - builtin/verify-commit.c | 3 +-- builtin/verify-pack.c | 1 - builtin/verify-tag.c | 3 +-- builtin/worktree.c | 3 +-- builtin/write-tree.c | 1 - cache-tree.c | 2 +- cache.h | 6 ------ compat/fsmonitor/fsm-health-win32.c | 2 +- compat/fsmonitor/fsm-listen-win32.c | 2 +- compat/fsmonitor/fsm-path-utils-darwin.c | 1 + compat/fsmonitor/fsm-path-utils-win32.c | 2 +- compat/fsmonitor/fsm-settings-win32.c | 2 +- compat/mingw.c | 1 - compat/precompose_utf8.c | 2 +- compat/sha1-chunked.c | 2 +- compat/simple-ipc/ipc-win32.c | 2 +- compat/win32/trace2_win32_process_info.c | 2 +- convert.c | 2 +- diff-lib.c | 2 +- diff.c | 2 +- entry.c | 2 +- environment.c | 2 +- fsmonitor-ipc.c | 2 +- fsmonitor.c | 2 +- fsmonitor.h | 1 - hash-lookup.c | 2 +- merge-ort-wrappers.c | 2 +- merge-ort.c | 2 +- merge-recursive.c | 2 +- merge.c | 2 +- name-hash.c | 2 +- object-name.c | 2 +- object.c | 2 +- parallel-checkout.c | 2 +- pathspec.c | 2 +- preload-index.c | 2 +- read-cache.c | 2 +- refs/files-backend.c | 2 +- refs/packed-backend.c | 2 +- repository.c | 2 +- rerere.c | 2 +- resolve-undo.c | 2 +- revision.c | 2 +- run-command.h | 2 +- sequencer.c | 2 +- shallow.c | 2 +- sparse-index.c | 2 +- split-index.c | 2 +- strbuf.h | 4 ---- submodule.c | 2 +- t/helper/test-cache-tree.c | 1 - t/helper/test-dump-cache-tree.c | 1 - t/helper/test-dump-fsmonitor.c | 1 - t/helper/test-dump-split-index.c | 1 - t/helper/test-dump-untracked-cache.c | 1 - t/helper/test-fast-rebase.c | 1 - t/helper/test-fsmonitor-client.c | 1 - t/helper/test-hash-speed.c | 1 - t/helper/test-index-version.c | 1 - t/helper/test-lazy-init-name-hash.c | 1 - t/helper/test-path-utils.c | 1 - t/helper/test-read-cache.c | 1 - t/helper/test-scrap-cache-tree.c | 1 - t/helper/test-sha1.c | 1 - t/helper/test-sha256.c | 1 - t/helper/test-strcmp-offset.c | 1 - t/helper/test-write-cache.c | 1 - unpack-trees.c | 2 +- wt-status.c | 2 +- 149 files changed, 99 insertions(+), 205 deletions(-) delete mode 100644 cache.h
Documentation/CodingGuidelines +1 -1
@@ -444,7 +444,7 @@ For C programs: - The first #include in C files, except in platform specific compat/ implementations and sha1dc/, must be either "git-compat-util.h" or one of the approved headers that includes it first for you. (The - approved headers currently include "cache.h", "builtin.h", + approved headers currently include "builtin.h", "t/helper/test-tool.h", "xdiff/xinclude.h", or "reftable/system.h"). You do not have to include more than one of these.
Documentation/MyFirstObjectWalk.txt +1 -1
@@ -124,7 +124,7 @@ parameters provided by the user over the CLI. `nr` represents the number of `rev_cmdline_entry` present in the array. -`alloc` is used by the `ALLOC_GROW` macro. Check `cache.h` - this variable is +`alloc` is used by the `ALLOC_GROW` macro. Check `alloc.h` - this variable is used to track the allocated size of the list. Per entry, we find:
Documentation/user-manual.txt +8 -10
@@ -4102,13 +4102,11 @@ Note that terminology has changed since that revision. For example, the README in that revision uses the word "changeset" to describe what we now call a <<def_commit_object,commit>>. -Also, we do not call it "cache" any more, but rather "index"; however, the -file is still called `cache.h`. Remark: Not much reason to change it now, -especially since there is no good single name for it anyway, because it is -basically _the_ header file which is included by _all_ of Git's C sources. +Also, we do not call it "cache" any more, but rather "index"; however, +the file is still called `read-cache.h`. If you grasp the ideas in that initial commit, you should check out a -more recent version and skim `cache.h`, `object.h` and `commit.h`. +more recent version and skim `read-cache-ll.h`, `object.h` and `commit.h`. In the early days, Git (in the tradition of UNIX) was a bunch of programs which were extremely simple, and which you used in scripts, piping the
@@ -4119,11 +4117,11 @@ many of these parts have become builtins, and some of the core has been and to avoid code duplication. By now, you know what the index is (and find the corresponding data -structures in `cache.h`), and that there are just a couple of object types -(blobs, trees, commits and tags) which inherit their common structure from -`struct object`, which is their first member (and thus, you can cast e.g. -`(struct object *)commit` to achieve the _same_ as `&commit->object`, i.e. -get at the object name and flags). +structures in `read-cache-ll.h`), and that there are just a couple of +object types (blobs, trees, commits and tags) which inherit their +common structure from `struct object`, which is their first member +(and thus, you can cast e.g. `(struct object *)commit` to achieve the +_same_ as `&commit->object`, i.e. get at the object name and flags). Now is a good point to take a break to let this information sink in.
Makefile +1 -1
@@ -1952,7 +1952,7 @@ endif BASIC_CFLAGS += \ -DSHA1DC_NO_STANDARD_INCLUDES \ -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \ - -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \ + -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" \ -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" endif endif
add-interactive.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "add-interactive.h" #include "color.h" #include "config.h"
add-patch.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "add-interactive.h" #include "advice.h" #include "alloc.h"
apply.c +1 -1
@@ -7,7 +7,7 @@* */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "base85.h"
attr.c +1 -1
@@ -6,7 +6,7 @@* an insanely large number of attributes. */ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "config.h" #include "environment.h"
blame.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "refs.h" #include "object-store.h" #include "cache-tree.h"
builtin.h +0 -1
@@ -3,7 +3,6 @@#include "git-compat-util.h" #include "strbuf.h" -#include "cache.h" #include "commit.h" /*
builtin/add.c +1 -2
@@ -4,10 +4,9 @@* Copyright (C) 2006 Linus Torvalds */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "config.h" -#include "builtin.h" #include "lockfile.h" #include "editor.h" #include "dir.h"
builtin/am.c +1 -2
@@ -4,11 +4,10 @@* Based on git-am.sh by Junio C Hamano. */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "advice.h" #include "config.h" -#include "builtin.h" #include "editor.h" #include "environment.h" #include "exec-cmd.h"
builtin/apply.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "gettext.h" #include "parse-options.h"
builtin/archive.c +0 -1
@@ -2,7 +2,6 @@* Copyright (c) 2006 Franck Bui-Huu * Copyright (c) 2006 Rene Scharfe */ -#include "cache.h" #include "builtin.h" #include "archive.h" #include "gettext.h"
builtin/bisect.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "copy.h" #include "environment.h" #include "gettext.h"
builtin/branch.c +1 -2
@@ -5,14 +5,13 @@* Based on git-branch.sh by Junio C Hamano. */ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "color.h" #include "editor.h" #include "environment.h" #include "refs.h" #include "commit.h" -#include "builtin.h" #include "gettext.h" #include "object-name.h" #include "remote.h"
builtin/bundle.c +0 -1
@@ -6,7 +6,6 @@#include "parse-options.h" #include "pkt-line.h" #include "repository.h" -#include "cache.h" #include "bundle.h" /*
builtin/cat-file.c +1 -2
@@ -4,11 +4,10 @@* Copyright (C) Linus Torvalds, 2005 */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "alloc.h" #include "config.h" #include "convert.h" -#include "builtin.h" #include "diff.h" #include "environment.h" #include "gettext.h"
builtin/check-attr.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "cache.h" #include "config.h" #include "attr.h" #include "environment.h"
builtin/check-ignore.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "cache.h" #include "config.h" #include "dir.h" #include "gettext.h"
builtin/check-ref-format.c +1 -2
@@ -2,9 +2,8 @@* GIT - The information manager from hell */ -#include "cache.h" -#include "refs.h" #include "builtin.h" +#include "refs.h" #include "setup.h" #include "strbuf.h"
builtin/clean.c +0 -1
@@ -9,7 +9,6 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "abspath.h" -#include "cache.h" #include "config.h" #include "dir.h" #include "gettext.h"
builtin/column.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "strbuf.h"
builtin/commit-tree.c +1 -2
@@ -3,7 +3,7 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "gettext.h" #include "hex.h"
@@ -12,7 +12,6 @@#include "repository.h" #include "commit.h" #include "tree.h" -#include "builtin.h" #include "utf8.h" #include "gpg-interface.h" #include "parse-options.h"
builtin/commit.c +1 -2
@@ -6,7 +6,7 @@*/ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "config.h" #include "lockfile.h"
@@ -15,7 +15,6 @@#include "dir.h" #include "editor.h" #include "environment.h" -#include "builtin.h" #include "diff.h" #include "diffcore.h" #include "commit.h"
builtin/count-objects.c +1 -2
@@ -4,13 +4,12 @@* Copyright (c) 2006 Junio C Hamano */ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "dir.h" #include "environment.h" #include "gettext.h" #include "repository.h" -#include "builtin.h" #include "parse-options.h" #include "quote.h" #include "packfile.h"
builtin/describe.c +1 -2
@@ -1,5 +1,5 @@#define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "config.h" #include "environment.h" #include "gettext.h"
@@ -9,7 +9,6 @@#include "tag.h" #include "blob.h" #include "refs.h" -#include "builtin.h" #include "exec-cmd.h" #include "object-name.h" #include "parse-options.h"
builtin/diff-files.c +1 -2
@@ -3,14 +3,13 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "diff.h" #include "diff-merges.h" #include "commit.h" #include "preload-index.h" #include "revision.h" -#include "builtin.h" #include "submodule.h" static const char diff_files_usage[] =
builtin/diff-index.c +1 -2
@@ -1,11 +1,10 @@ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "diff.h" #include "diff-merges.h" #include "commit.h" #include "preload-index.h" #include "revision.h" -#include "builtin.h" #include "setup.h" #include "submodule.h"
builtin/diff-tree.c +1 -2
@@ -1,12 +1,11 @@#define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "config.h" #include "diff.h" #include "commit.h" #include "gettext.h" #include "hex.h" #include "log-tree.h" -#include "builtin.h" #include "submodule.h" #include "read-cache-ll.h" #include "repository.h"
builtin/diff.c +1 -2
@@ -4,7 +4,7 @@* Copyright (c) 2006 Junio C Hamano */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "config.h" #include "ewah/ewok.h" #include "lockfile.h"
@@ -20,7 +20,6 @@#include "read-cache-ll.h" #include "revision.h" #include "log-tree.h" -#include "builtin.h" #include "setup.h" #include "submodule.h" #include "oid-array.h"
builtin/difftool.c +1 -2
@@ -12,11 +12,10 @@* Copyright (C) 2016 Johannes Schindelin */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "config.h" #include "copy.h" -#include "builtin.h" #include "run-command.h" #include "environment.h" #include "exec-cmd.h"
builtin/fast-export.c +0 -1
@@ -4,7 +4,6 @@* Copyright (C) 2007 Johannes E. Schindelin */ #include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "hex.h"
builtin/fast-import.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "cache.h" #include "environment.h" #include "gettext.h" #include "hex.h"
builtin/fetch.c +1 -2
@@ -1,7 +1,7 @@/* * "git fetch" */ -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "config.h" #include "gettext.h"
@@ -15,7 +15,6 @@#include "oidset.h" #include "oid-array.h" #include "commit.h" -#include "builtin.h" #include "string-list.h" #include "remote.h" #include "transport.h"
builtin/for-each-ref.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "refs.h"
builtin/for-each-repo.c +1 -2
@@ -1,6 +1,5 @@ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "gettext.h" #include "parse-options.h" #include "path.h"
builtin/fsck.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "gettext.h" #include "hex.h" #include "repository.h"
builtin/get-tar-commit-id.c +1 -2
@@ -1,10 +1,9 @@/* * Copyright (c) 2005, 2006 Rene Scharfe */ -#include "cache.h" +#include "builtin.h" #include "commit.h" #include "tar.h" -#include "builtin.h" #include "quote.h" #include "wrapper.h"
builtin/grep.c +1 -2
@@ -3,7 +3,7 @@* * Copyright (c) 2006 Junio C Hamano */ -#include "cache.h" +#include "builtin.h" #include "alloc.h" #include "gettext.h" #include "hex.h"
@@ -14,7 +14,6 @@#include "commit.h" #include "tag.h" #include "tree-walk.h" -#include "builtin.h" #include "parse-options.h" #include "string-list.h" #include "run-command.h"
builtin/help.c +1 -2
@@ -1,9 +1,8 @@/* * Builtin help command */ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "exec-cmd.h" #include "gettext.h" #include "pager.h"
builtin/hook.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "config.h" #include "gettext.h"
builtin/init-db.c +1 -2
@@ -3,12 +3,11 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "config.h" #include "environment.h" #include "gettext.h" -#include "builtin.h" #include "object-file.h" #include "parse-options.h" #include "path.h"
builtin/interpret-trailers.c +0 -1
@@ -5,7 +5,6 @@* */ -#include "cache.h" #include "builtin.h" #include "gettext.h" #include "parse-options.h"
builtin/ls-files.c +1 -2
@@ -5,13 +5,12 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "builtin.h" #include "repository.h" #include "config.h" #include "convert.h" #include "quote.h" #include "dir.h" -#include "builtin.h" #include "gettext.h" #include "object-name.h" #include "strbuf.h"
builtin/ls-remote.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "gettext.h" #include "hex.h" #include "transport.h"
builtin/ls-tree.c +1 -2
@@ -3,7 +3,7 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "gettext.h" #include "hex.h"
@@ -13,7 +13,6 @@#include "tree.h" #include "commit.h" #include "quote.h" -#include "builtin.h" #include "parse-options.h" #include "pathspec.h"
builtin/mailinfo.c +1 -2
@@ -2,9 +2,8 @@* Another stupid program, this one parsing the headers of an * email to figure out authorship and subject */ -#include "cache.h" -#include "abspath.h" #include "builtin.h" +#include "abspath.h" #include "environment.h" #include "gettext.h" #include "utf8.h"
builtin/mailsplit.c +0 -1
@@ -4,7 +4,6 @@* It just splits a mbox into a list of files: "0001" "0002" .. * so you can process them further from there. */ -#include "cache.h" #include "builtin.h" #include "gettext.h" #include "string-list.h"
builtin/merge-base.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "commit.h" #include "gettext.h"
builtin/merge-file.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "setup.h"
builtin/merge-recursive.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "advice.h" #include "commit.h"
builtin/merge.c +1 -2
@@ -7,7 +7,7 @@*/ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "advice.h" #include "alloc.h"
@@ -18,7 +18,6 @@#include "hex.h" #include "object-name.h" #include "parse-options.h" -#include "builtin.h" #include "lockfile.h" #include "run-command.h" #include "hook.h"
builtin/multi-pack-index.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "cache.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/notes.c +1 -2
@@ -7,9 +7,8 @@* and builtin/tag.c by Kristian Høgsberg and Carlos Rica. */ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "editor.h" #include "gettext.h" #include "hex.h"
builtin/patch-id.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "config.h" #include "diff.h"
builtin/prune.c +1 -2
@@ -1,11 +1,10 @@ -#include "cache.h" +#include "builtin.h" #include "commit.h" #include "diff.h" #include "environment.h" #include "gettext.h" #include "hex.h" #include "revision.h" -#include "builtin.h" #include "reachable.h" #include "parse-options.h" #include "progress.h"
builtin/pull.c +1 -2
@@ -6,10 +6,9 @@* Fetch one or more remote refs and merge it/them into the current HEAD. */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "config.h" -#include "builtin.h" #include "gettext.h" #include "hex.h" #include "merge.h"
builtin/push.c +1 -2
@@ -1,7 +1,7 @@/* * "git push" */ -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "branch.h" #include "config.h"
@@ -10,7 +10,6 @@#include "refs.h" #include "refspec.h" #include "run-command.h" -#include "builtin.h" #include "remote.h" #include "transport.h" #include "parse-options.h"
builtin/range-diff.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "gettext.h" #include "object-name.h"
builtin/read-tree.c +1 -2
@@ -5,7 +5,7 @@*/ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "config.h" #include "gettext.h" #include "hex.h"
@@ -17,7 +17,6 @@#include "cache-tree.h" #include "unpack-trees.h" #include "dir.h" -#include "builtin.h" #include "parse-options.h" #include "repository.h" #include "resolve-undo.h"
builtin/replace.c +1 -2
@@ -8,9 +8,8 @@* git-tag.sh and mktag.c by Linus Torvalds. */ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "editor.h" #include "environment.h" #include "gettext.h"
builtin/rerere.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "dir.h" #include "gettext.h"
builtin/rev-list.c +1 -2
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "commit.h" #include "diff.h"
@@ -15,7 +15,6 @@#include "object-store.h" #include "pack.h" #include "pack-bitmap.h" -#include "builtin.h" #include "log-tree.h" #include "graph.h" #include "bisect.h"
builtin/rev-parse.c +1 -2
@@ -4,7 +4,7 @@* Copyright (C) Linus Torvalds, 2005 */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "alloc.h" #include "config.h"
@@ -14,7 +14,6 @@#include "hex.h" #include "refs.h" #include "quote.h" -#include "builtin.h" #include "object-name.h" #include "parse-options.h" #include "diff.h"
builtin/shortlog.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "commit.h" #include "diff.h"
builtin/show-branch.c +1 -2
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "environment.h" #include "gettext.h"
@@ -6,7 +6,6 @@#include "hex.h" #include "pretty.h" #include "refs.h" -#include "builtin.h" #include "color.h" #include "strvec.h" #include "object-name.h"
builtin/show-index.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "gettext.h" #include "hash.h" #include "hex.h"
builtin/show-ref.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "hex.h"
builtin/sparse-checkout.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "dir.h" #include "environment.h"
builtin/stripspace.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "parse-options.h"
builtin/submodule--helper.c +0 -1
@@ -6,7 +6,6 @@#include "gettext.h" #include "hex.h" #include "repository.h" -#include "cache.h" #include "config.h" #include "parse-options.h" #include "quote.h"
builtin/symbolic-ref.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "config.h" -#include "cache.h" #include "gettext.h" #include "refs.h" #include "parse-options.h"
builtin/tag.c +1 -2
@@ -6,10 +6,9 @@* Based on git-tag.sh and mktag.c by Linus Torvalds. */ -#include "cache.h" +#include "builtin.h" #include "advice.h" #include "config.h" -#include "builtin.h" #include "editor.h" #include "environment.h" #include "gettext.h"
builtin/unpack-objects.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "bulk-checkin.h" #include "config.h" #include "environment.h"
builtin/update-index.c +1 -2
@@ -4,7 +4,7 @@* Copyright (C) Linus Torvalds, 2005 */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "builtin.h" #include "bulk-checkin.h" #include "config.h" #include "environment.h"
@@ -15,7 +15,6 @@#include "quote.h" #include "cache-tree.h" #include "tree-walk.h" -#include "builtin.h" #include "object-file.h" #include "refs.h" #include "resolve-undo.h"
builtin/update-ref.c +1 -2
@@ -1,9 +1,8 @@ -#include "cache.h" +#include "builtin.h" #include "config.h" #include "gettext.h" #include "hash.h" #include "refs.h" -#include "builtin.h" #include "object-name.h" #include "parse-options.h" #include "quote.h"
builtin/update-server-info.c +1 -2
@@ -1,6 +1,5 @@ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "gettext.h" #include "parse-options.h" #include "server-info.h"
builtin/upload-archive.c +0 -1
@@ -1,7 +1,6 @@/* * Copyright (c) 2006 Franck Bui-Huu */ -#include "cache.h" #include "builtin.h" #include "archive.h" #include "pkt-line.h"
builtin/upload-pack.c +0 -1
@@ -1,4 +1,3 @@ -#include "cache.h" #include "builtin.h" #include "exec-cmd.h" #include "gettext.h"
builtin/verify-commit.c +1 -2
@@ -5,9 +5,8 @@* * Based on git-verify-tag */ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "gettext.h" #include "object-name.h" #include "object-store.h"
builtin/verify-pack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "cache.h" #include "config.h" #include "gettext.h" #include "run-command.h"
builtin/verify-tag.c +1 -2
@@ -5,9 +5,8 @@* * Based on git-verify-tag.sh */ -#include "cache.h" -#include "config.h" #include "builtin.h" +#include "config.h" #include "gettext.h" #include "tag.h" #include "run-command.h"
builtin/worktree.c +1 -2
@@ -1,9 +1,8 @@ -#include "cache.h" +#include "builtin.h" #include "abspath.h" #include "checkout.h" #include "config.h" #include "copy.h" -#include "builtin.h" #include "dir.h" #include "environment.h" #include "gettext.h"
builtin/write-tree.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "cache.h" #include "config.h" #include "environment.h" #include "gettext.h"
cache-tree.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "environment.h" #include "hex.h"
cache.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef CACHE_H -#define CACHE_H - -#include "git-compat-util.h" - -#endif /* CACHE_H */
compat/fsmonitor/fsm-health-win32.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "fsmonitor.h" #include "fsm-health.h"
compat/fsmonitor/fsm-listen-win32.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "fsmonitor.h" #include "fsm-listen.h"
compat/fsmonitor/fsm-path-utils-darwin.c +1 -0
@@ -1,3 +1,4 @@ +#include "git-compat-util.h" #include "fsmonitor.h" #include "fsmonitor-path-utils.h" #include "gettext.h"
compat/fsmonitor/fsm-path-utils-win32.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "fsmonitor.h" #include "fsmonitor-path-utils.h" #include "gettext.h"
compat/fsmonitor/fsm-settings-win32.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "repository.h" #include "fsmonitor.h"
compat/mingw.c +0 -1
@@ -6,7 +6,6 @@#include <wchar.h> #include "../strbuf.h" #include "../run-command.h" -#include "../cache.h" #include "../abspath.h" #include "../alloc.h" #include "win32/lazyload.h"
compat/precompose_utf8.c +1 -1
@@ -5,7 +5,7 @@#define PRECOMPOSE_UNICODE_C -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "environment.h" #include "gettext.h"
compat/sha1-chunked.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "hash-ll.h" int git_SHA1_Update_Chunked (platform_SHA_CTX *c,const void *data,size_t len)
compat/simple-ipc/ipc-win32.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "gettext.h" #include "simple-ipc.h"
compat/win32/trace2_win32_process_info.c +1 -1
@@ -1,4 +1,4 @@ -#include "../../cache.h" +#include "../../git-compat-util.h" #include "../../json-writer.h" #include "../../repository.h" #include "../../trace2.h"
convert.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "advice.h" #include "config.h" #include "convert.h"
diff-lib.c +1 -1
@@ -1,7 +1,7 @@/* * Copyright (C) 2005 Junio C Hamano */ -#include "cache.h" +#include "git-compat-util.h" #include "quote.h" #include "commit.h" #include "diff.h"
diff.c +1 -1
@@ -1,7 +1,7 @@/* * Copyright (C) 2005 Junio C Hamano */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "base85.h"
entry.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "blob.h" #include "object-store.h" #include "dir.h"
environment.c +1 -1
@@ -110,7 +110,7 @@ char *git_work_tree_cfg;static char *git_namespace;/* -* Repository-local GIT_* environment variables; see cache.h for details. +* Repository-local GIT_* environment variables; see environment.h for details. */ const char *const local_repo_env[] = {ALTERNATE_DB_ENVIRONMENT ,
fsmonitor-ipc.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "fsmonitor.h" #include "gettext.h" #include "simple-ipc.h"
fsmonitor.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "dir.h" #include "environment.h"
fsmonitor.h +0 -1
@@ -1,7 +1,6 @@#ifndef FSMONITOR_H #define FSMONITOR_H -#include "cache.h" #include "dir.h" #include "fsmonitor-settings.h" #include "object.h"
hash-lookup.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "hash.h" #include "hash-lookup.h" #include "read-cache-ll.h"
merge-ort-wrappers.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "gettext.h" #include "hash.h" #include "merge-ort.h"
merge-ort.c +1 -1
@@ -14,7 +14,7 @@* "cale", "peedy", or "ins" instead of "ort"?) */ -#include "cache.h" +#include "git-compat-util.h" #include "merge-ort.h" #include "alloc.h"
merge-recursive.c +1 -1
@@ -3,7 +3,7 @@* Fredrik Kuivinen. * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006 */ -#include "cache.h" +#include "git-compat-util.h" #include "merge-recursive.h" #include "advice.h"
merge.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "diff.h" #include "diffcore.h" #include "gettext.h"
name-hash.c +1 -1
@@ -5,7 +5,7 @@* * Copyright (C) 2008 Linus Torvalds */ -#include "cache.h" +#include "git-compat-util.h" #include "environment.h" #include "gettext.h" #include "name-hash.h"
object-name.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "object-name.h" #include "advice.h" #include "config.h"
object.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "gettext.h" #include "hex.h" #include "object.h"
parallel-checkout.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "config.h" #include "entry.h"
pathspec.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "config.h" #include "dir.h"
preload-index.c +1 -1
@@ -1,7 +1,7 @@/* * Copyright (C) 2008 Linus Torvalds */ -#include "cache.h" +#include "git-compat-util.h" #include "pathspec.h" #include "dir.h" #include "environment.h"
read-cache.c +1 -1
@@ -3,7 +3,7 @@* * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "bulk-checkin.h" #include "config.h"
refs/files-backend.c +1 -1
@@ -1,4 +1,4 @@ -#include "../cache.h" +#include "../git-compat-util.h" #include "../config.h" #include "../copy.h" #include "../environment.h"
refs/packed-backend.c +1 -1
@@ -1,4 +1,4 @@ -#include "../cache.h" +#include "../git-compat-util.h" #include "../alloc.h" #include "../config.h" #include "../gettext.h"
repository.c +1 -1
@@ -3,7 +3,7 @@* declaration matches the definition in this file. */ #define USE_THE_INDEX_VARIABLE -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "repository.h" #include "object-store.h"
rerere.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "config.h"
resolve-undo.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "dir.h" #include "hash.h" #include "read-cache.h"
revision.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "config.h" #include "environment.h"
run-command.h +1 -1
@@ -503,7 +503,7 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts);* exception of GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT (which cause the * corresponding environment variables to be unset in the subprocess) and adds * an environment variable pointing to new_git_dir. See local_repo_env in -* cache.h for more information. +* environment.h for more information. */ void prepare_other_repo_env (struct strvec *env,const char *new_git_dir);
sequencer.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "advice.h" #include "alloc.h"
shallow.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "hex.h" #include "repository.h"
sparse-index.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "environment.h" #include "gettext.h"
split-index.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "gettext.h" #include "hash.h"
strbuf.h +0 -4
@@ -72,10 +72,6 @@ struct strbuf {extern char strbuf_slopbuf[];#define STRBUF_INIT { .buf = strbuf_slopbuf } -/* -* Predeclare this here, since cache.h includes this file before it defines the -* struct. -*/ struct object_id ;/**
submodule.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "repository.h"
t/helper/test-cache-tree.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "gettext.h" #include "hex.h" #include "tree.h"
t/helper/test-dump-cache-tree.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "hash.h" #include "hex.h" #include "tree.h"
t/helper/test-dump-fsmonitor.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "read-cache-ll.h" #include "repository.h" #include "setup.h"
t/helper/test-dump-split-index.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "hex.h" #include "read-cache-ll.h" #include "repository.h"
t/helper/test-dump-untracked-cache.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "dir.h" #include "hex.h" #include "read-cache-ll.h"
t/helper/test-fast-rebase.c +0 -1
@@ -12,7 +12,6 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "cache-tree.h" #include "commit.h" #include "environment.h"
t/helper/test-fsmonitor-client.c +0 -1
@@ -4,7 +4,6 @@*/ #include "test-tool.h" -#include "cache.h" #include "parse-options.h" #include "fsmonitor-ipc.h" #include "read-cache-ll.h"
t/helper/test-hash-speed.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "hash-ll.h" #define NUM_SECONDS 3
t/helper/test-index-version.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "read-cache-ll.h" int cmd__index_version(int argc UNUSED, const char **argv UNUSED)
t/helper/test-lazy-init-name-hash.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "environment.h" #include "name-hash.h" #include "parse-options.h"
t/helper/test-path-utils.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "abspath.h" #include "environment.h" #include "path.h"
t/helper/test-read-cache.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "config.h" #include "read-cache-ll.h" #include "repository.h"
t/helper/test-scrap-cache-tree.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "lockfile.h" #include "read-cache-ll.h" #include "repository.h"
t/helper/test-sha1.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "hash-ll.h" int cmd__sha1 (int ac,const char **av)
t/helper/test-sha256.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "hash-ll.h" int cmd__sha256 (int ac,const char **av)
t/helper/test-strcmp-offset.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "cache.h" #include "read-cache-ll.h" int cmd__strcmp_offset(int argc UNUSED, const char **argv)
t/helper/test-write-cache.c +0 -1
@@ -1,6 +1,5 @@#define USE_THE_INDEX_VARIABLE #include "test-tool.h" -#include "cache.h" #include "lockfile.h" #include "read-cache-ll.h" #include "repository.h"
unpack-trees.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "advice.h" #include "strvec.h" #include "repository.h"
wt-status.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "advice.h" #include "wt-status.h" #include "object.h"
Signature · 1 line
gitgitgadget
Re: [PATCH v2 17/27] cache.h: remove this no-longer-used header
Quoted 5 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
Since this header showed up in some places besides just #include statements, update/clean-up/remove those other places as well.
Quoted 8 lines
Note that
compat/fsmonitor/fsm-path-utils-darwin.cpreviously got away with violating the rule that all files must start with an include ofgit-compat-util.h(or a short-list of alternate headers that happen to include it first). This change exposed the violation and caused it to stop building correctly; fix it by having it includegit-compat-util.hfirst, as per policy.Signed-off-by Elijah Newren <[email protected]>
Ah, a monumental effort indeed (to finally remove cache.h). This patch was one of a few called out in the cover letter [1] as needing reviewer focus, but this patch seemed straightforward to me (changing the text wherever cache.h is mentioned in relatively obvious ways) so hopefully I'm not missing anything.
Re: [PATCH v2 17/27] cache.h: remove this no-longer-used header
Quoted 14 lines · Jonathan Tan
Quoted 12 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
Since this header showed up in some places besides just #include statements, update/clean-up/remove those other places as well.
Note that
compat/fsmonitor/fsm-path-utils-darwin.cpreviously got away with violating the rule that all files must start with an include ofgit-compat-util.h(or a short-list of alternate headers that happen to include it first). This change exposed the violation and caused it to stop building correctly; fix it by having it includegit-compat-util.hfirst, as per policy.
Quoted 7 lines
Quoted 1 line
Signed-off-by Elijah Newren <[email protected]>Ah, a monumental effort indeed (to finally remove
cache.h). This patch was one of a few called out in the cover letter [1] as needing reviewer focus, but this patch seemed straightforward to me (changing the text wherevercache.his mentioned in relatively obvious ways) so hopefully I'm not missing anything.
I mostly called it out simply because this patch was different than all the other ones, due to the Makefile and Documentation changes. I figured that those who wanted to "spot check" deserved an easy way to find the different kinds of changes involved.
Although, I was a bit curious after the patch what the purpose of the SHA1DC_CUSTOM_INCLUDE_SHA1_C and SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C defines were and why there were two different ones. I tried to do a little history spelunking to find out, but it didn't shed any light on the issue for me. Setting them both to git-compat-util.h works just fine, so...*shrug*.
PATCH v2 18/27 log-tree: replace include of revision.h with simple forward declaration
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- builtin/diff-tree.c | 1 + log-tree.c | 1 + log-tree.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
builtin/diff-tree.c +1 -0
@@ -9,6 +9,7 @@#include "submodule.h" #include "read-cache-ll.h" #include "repository.h" +#include "revision.h" #include "tree.h" static struct rev_info log_tree_opt;
log-tree.c +1 -0
@@ -16,6 +16,7 @@#include "reflog-walk.h" #include "refs.h" #include "replace-object.h" +#include "revision.h" #include "string-list.h" #include "color.h" #include "gpg-interface.h"
log-tree.h +1 -1
@@ -1,7 +1,7 @@ #ifndef LOG_TREE_H #define LOG_TREE_H -#include "revision.h" +struct rev_info; struct log_info { struct commit *commit, *parent;
Signature · 1 line
gitgitgadget
PATCH v2 19/27 repository: remove unnecessary include of path.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
This also made it clear that several .c files that depended upon path.h were missing a #include for it; add the missing includes while at it.
--- apply.c | 1 + archive.c | 1 + attr.c | 1 + bisect.c | 1 + blame.c | 1 + branch.c | 1 + builtin/add.c | 1 + builtin/am.c | 1 + builtin/bisect.c | 1 + builtin/branch.c | 1 + builtin/checkout.c | 1 + builtin/clean.c | 1 + builtin/clone.c | 1 + builtin/commit.c | 1 + builtin/count-objects.c | 1 + builtin/fast-import.c | 1 + builtin/fetch.c | 1 + builtin/fsck.c | 1 + builtin/gc.c | 1 + builtin/grep.c | 1 + builtin/ls-files.c | 1 + builtin/ls-tree.c | 1 + builtin/merge.c | 1 + builtin/notes.c | 1 + builtin/prune.c | 1 + builtin/pull.c | 1 + builtin/rebase.c | 1 + builtin/receive-pack.c | 1 + builtin/remote.c | 1 + builtin/repack.c | 1 + builtin/replace.c | 1 + builtin/reset.c | 1 + builtin/rev-parse.c | 1 + builtin/submodule--helper.c | 1 + builtin/tag.c | 1 + builtin/upload-archive.c | 1 + builtin/upload-pack.c | 1 + builtin/worktree.c | 1 + commit-graph.c | 1 + compat/fsmonitor/fsm-ipc-darwin.c | 1 + config.c | 1 + connect.c | 1 + dir.c | 1 + environment.c | 1 + fetch-pack.c | 1 + fsck.c | 1 + http-backend.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + notes-merge.c | 1 + object-file.c | 1 + pack-bitmap-write.c | 1 + pack-write.c | 1 + read-cache.c | 1 + refs.c | 1 + refs/files-backend.c | 1 + remote.c | 1 + repository.c | 1 + repository.h | 2 -- rerere.c | 1 + sequencer.c | 1 + server-info.c | 1 + setup.c | 1 + shallow.c | 1 + strbuf.c | 1 + submodule-config.c | 1 + submodule.c | 1 + t/helper/test-ref-store.c | 1 + tmp-objdir.c | 1 + worktree.c | 1 + wt-status.c | 1 + 71 files changed, 70 insertions(+), 2 deletions(-)
apply.c +1 -0
@@ -27,6 +27,7 @@#include "object-name.h" #include "object-file.h" #include "parse-options.h" +#include "path.h" #include "quote.h" #include "read-cache.h" #include "rerere.h"
archive.c +1 -0
@@ -6,6 +6,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "path.h" #include "pretty.h" #include "setup.h" #include "refs.h"
attr.c +1 -0
@@ -14,6 +14,7 @@#include "attr.h" #include "dir.h" #include "gettext.h" +#include "path.h" #include "utf8.h" #include "quote.h" #include "read-cache-ll.h"
bisect.c +1 -0
@@ -19,6 +19,7 @@#include "commit-reach.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "dir.h" static struct oid_array good_revs;
blame.c +1 -0
@@ -8,6 +8,7 @@#include "diffcore.h" #include "gettext.h" #include "hex.h" +#include "path.h" #include "read-cache.h" #include "setup.h" #include "tag.h"
branch.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" +#include "path.h" #include "refs.h" #include "refspec.h" #include "remote.h"
builtin/add.c +1 -0
@@ -16,6 +16,7 @@#include "cache-tree.h" #include "run-command.h" #include "parse-options.h" +#include "path.h" #include "preload-index.h" #include "diff.h" #include "diffcore.h"
builtin/am.c +1 -0
@@ -41,6 +41,7 @@#include "string-list.h" #include "packfile.h" #include "pager.h" +#include "path.h" #include "repository.h" #include "pretty.h" #include "wrapper.h"
builtin/bisect.c +1 -0
@@ -11,6 +11,7 @@#include "strvec.h" #include "run-command.h" #include "oid-array.h" +#include "path.h" #include "prompt.h" #include "quote.h" #include "revision.h"
builtin/branch.c +1 -0
@@ -18,6 +18,7 @@#include "parse-options.h" #include "branch.h" #include "diff.h" +#include "path.h" #include "revision.h" #include "string-list.h" #include "column.h"
builtin/checkout.c +1 -0
@@ -20,6 +20,7 @@#include "object-name.h" #include "object-store.h" #include "parse-options.h" +#include "path.h" #include "preload-index.h" #include "read-cache.h" #include "refs.h"
builtin/clean.c +1 -0
@@ -13,6 +13,7 @@#include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "path.h" #include "read-cache-ll.h" #include "repository.h" #include "setup.h"
builtin/clone.c +1 -0
@@ -39,6 +39,7 @@#include "setup.h" #include "connected.h" #include "packfile.h" +#include "path.h" #include "pkt-line.h" #include "list-objects-filter-options.h" #include "hook.h"
builtin/commit.c +1 -0
@@ -29,6 +29,7 @@#include "utf8.h" #include "object-name.h" #include "parse-options.h" +#include "path.h" #include "preload-index.h" #include "read-cache.h" #include "string-list.h"
builtin/count-objects.c +1 -0
@@ -9,6 +9,7 @@#include "dir.h" #include "environment.h" #include "gettext.h" +#include "path.h" #include "repository.h" #include "parse-options.h" #include "quote.h"
builtin/fast-import.c +1 -0
@@ -12,6 +12,7 @@#include "commit.h" #include "delta.h" #include "pack.h" +#include "path.h" #include "refs.h" #include "csum-file.h" #include "quote.h"
builtin/fetch.c +1 -0
@@ -28,6 +28,7 @@#include "utf8.h" #include "packfile.h" #include "pager.h" +#include "path.h" #include "pkt-line.h" #include "list-objects-filter-options.h" #include "commit-reach.h"
builtin/fsck.c +1 -0
@@ -21,6 +21,7 @@#include "object-file.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "read-cache-ll.h" #include "replace-object.h" #include "resolve-undo.h"
builtin/gc.c +1 -0
@@ -30,6 +30,7 @@#include "object-store.h" #include "pack.h" #include "pack-objects.h" +#include "path.h" #include "blob.h" #include "tree.h" #include "promisor-remote.h"
builtin/grep.c +1 -0
@@ -30,6 +30,7 @@#include "object-store.h" #include "packfile.h" #include "pager.h" +#include "path.h" #include "read-cache-ll.h" #include "write-or-die.h"
builtin/ls-files.c +1 -0
@@ -19,6 +19,7 @@#include "parse-options.h" #include "resolve-undo.h" #include "string-list.h" +#include "path.h" #include "pathspec.h" #include "read-cache.h" #include "run-command.h"
builtin/ls-tree.c +1 -0
@@ -12,6 +12,7 @@#include "blob.h" #include "tree.h" #include "commit.h" +#include "path.h" #include "quote.h" #include "parse-options.h" #include "pathspec.h"
builtin/merge.c +1 -0
@@ -27,6 +27,7 @@#include "refspec.h" #include "commit.h" #include "diffcore.h" +#include "path.h" #include "revision.h" #include "unpack-trees.h" #include "cache-tree.h"
builtin/notes.c +1 -0
@@ -15,6 +15,7 @@#include "notes.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "repository.h" #include "blob.h" #include "pretty.h"
builtin/prune.c +1 -0
@@ -7,6 +7,7 @@#include "revision.h" #include "reachable.h" #include "parse-options.h" +#include "path.h" #include "progress.h" #include "prune-packed.h" #include "replace-object.h"
builtin/pull.c +1 -0
@@ -19,6 +19,7 @@#include "oid-array.h" #include "remote.h" #include "dir.h" +#include "path.h" #include "read-cache-ll.h" #include "rebase.h" #include "refs.h"
builtin/rebase.c +1 -0
@@ -24,6 +24,7 @@#include "object-file.h" #include "object-name.h" #include "parse-options.h" +#include "path.h" #include "commit.h" #include "diff.h" #include "wt-status.h"
builtin/receive-pack.c +1 -0
@@ -31,6 +31,7 @@#include "packfile.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "protocol.h" #include "commit-reach.h" #include "server-info.h"
builtin/remote.c +1 -0
@@ -2,6 +2,7 @@#include "config.h" #include "gettext.h" #include "parse-options.h" +#include "path.h" #include "transport.h" #include "remote.h" #include "string-list.h"
builtin/repack.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "hex.h" #include "parse-options.h" +#include "path.h" #include "run-command.h" #include "server-info.h" #include "sigchain.h"
builtin/replace.c +1 -0
@@ -16,6 +16,7 @@#include "hex.h" #include "refs.h" #include "parse-options.h" +#include "path.h" #include "run-command.h" #include "object-file.h" #include "object-name.h"
builtin/reset.c +1 -0
@@ -26,6 +26,7 @@#include "branch.h" #include "object-name.h" #include "parse-options.h" +#include "path.h" #include "unpack-trees.h" #include "cache-tree.h" #include "setup.h"
builtin/rev-parse.c +1 -0
@@ -16,6 +16,7 @@#include "quote.h" #include "object-name.h" #include "parse-options.h" +#include "path.h" #include "diff.h" #include "read-cache-ll.h" #include "revision.h"
builtin/submodule--helper.c +1 -0
@@ -9,6 +9,7 @@#include "config.h" #include "parse-options.h" #include "quote.h" +#include "path.h" #include "pathspec.h" #include "preload-index.h" #include "dir.h"
builtin/tag.c +1 -0
@@ -16,6 +16,7 @@#include "refs.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "tag.h" #include "run-command.h" #include "parse-options.h"
builtin/upload-archive.c +1 -0
@@ -3,6 +3,7 @@*/ #include "builtin.h" #include "archive.h" +#include "path.h" #include "pkt-line.h" #include "sideband.h" #include "repository.h"
builtin/upload-pack.c +1 -0
@@ -3,6 +3,7 @@#include "gettext.h" #include "pkt-line.h" #include "parse-options.h" +#include "path.h" #include "protocol.h" #include "replace-object.h" #include "upload-pack.h"
builtin/worktree.c +1 -0
@@ -10,6 +10,7 @@#include "object-file.h" #include "object-name.h" #include "parse-options.h" +#include "path.h" #include "strvec.h" #include "branch.h" #include "read-cache-ll.h"
commit-graph.c +1 -0
@@ -14,6 +14,7 @@#include "object-file.h" #include "object-store.h" #include "oid-array.h" +#include "path.h" #include "alloc.h" #include "hashmap.h" #include "replace-object.h"
compat/fsmonitor/fsm-ipc-darwin.c +1 -0
@@ -2,6 +2,7 @@#include "config.h" #include "gettext.h" #include "hex.h" +#include "path.h" #include "repository.h" #include "strbuf.h" #include "fsmonitor.h"
config.c +1 -0
@@ -27,6 +27,7 @@#include "object-name.h" #include "object-store.h" #include "pager.h" +#include "path.h" #include "utf8.h" #include "dir.h" #include "color.h"
connect.c +1 -0
@@ -12,6 +12,7 @@#include "url.h" #include "string-list.h" #include "oid-array.h" +#include "path.h" #include "transport.h" #include "trace2.h" #include "strbuf.h"
dir.c +1 -0
@@ -16,6 +16,7 @@#include "name-hash.h" #include "object-file.h" #include "object-store.h" +#include "path.h" #include "attr.h" #include "refs.h" #include "wildmatch.h"
environment.c +1 -0
@@ -21,6 +21,7 @@#include "strvec.h" #include "object-file.h" #include "object-store.h" +#include "path.h" #include "replace-object.h" #include "tmp-objdir.h" #include "chdir-notify.h"
fetch-pack.c +1 -0
@@ -25,6 +25,7 @@#include "oidset.h" #include "packfile.h" #include "object-store.h" +#include "path.h" #include "connected.h" #include "fetch-negotiator.h" #include "fsck.h"
fsck.c +1 -0
@@ -3,6 +3,7 @@#include "date.h" #include "hex.h" #include "object-store.h" +#include "path.h" #include "repository.h" #include "object.h" #include "attr.h"
http-backend.c +1 -0
@@ -4,6 +4,7 @@#include "environment.h" #include "git-zlib.h" #include "hex.h" +#include "path.h" #include "repository.h" #include "refs.h" #include "pkt-line.h"
merge-ort.c +1 -0
@@ -36,6 +36,7 @@#include "object-name.h" #include "object-store.h" #include "oid-array.h" +#include "path.h" #include "promisor-remote.h" #include "read-cache-ll.h" #include "revision.h"
merge-recursive.c +1 -0
@@ -27,6 +27,7 @@#include "object-file.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "repository.h" #include "revision.h" #include "sparse-index.h"
notes-merge.c +1 -0
@@ -6,6 +6,7 @@#include "object-file.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "repository.h" #include "diff.h" #include "diffcore.h"
object-file.c +1 -0
@@ -39,6 +39,7 @@#include "object-file.h" #include "object-store.h" #include "oidtree.h" +#include "path.h" #include "promisor-remote.h" #include "setup.h" #include "submodule.h"
pack-bitmap-write.c +1 -0
@@ -15,6 +15,7 @@#include "pack-bitmap.h" #include "hash-lookup.h" #include "pack-objects.h" +#include "path.h" #include "commit-reach.h" #include "prio-queue.h" #include "trace2.h"
pack-write.c +1 -0
@@ -10,6 +10,7 @@#include "oidmap.h" #include "pack-objects.h" #include "pack-revindex.h" +#include "path.h" #include "wrapper.h" void reset_pack_idx_option (struct pack_idx_option *opts)
read-cache.c +1 -0
@@ -27,6 +27,7 @@#include "mem-pool.h" #include "name-hash.h" #include "object-name.h" +#include "path.h" #include "preload-index.h" #include "read-cache.h" #include "resolve-undo.h"
refs.c +1 -0
@@ -19,6 +19,7 @@#include "object-name.h" #include "object-store.h" #include "object.h" +#include "path.h" #include "tag.h" #include "submodule.h" #include "worktree.h"
refs/files-backend.c +1 -0
@@ -15,6 +15,7 @@#include "../lockfile.h" #include "../object.h" #include "../object-file.h" +#include "../path.h" #include "../dir.h" #include "../chdir-notify.h" #include "../setup.h"
remote.c +1 -0
@@ -11,6 +11,7 @@#include "refspec.h" #include "object-name.h" #include "object-store.h" +#include "path.h" #include "commit.h" #include "diff.h" #include "revision.h"
repository.c +1 -0
@@ -10,6 +10,7 @@#include "config.h" #include "object.h" #include "lockfile.h" +#include "path.h" #include "read-cache-ll.h" #include "remote.h" #include "setup.h"
repository.h +0 -2
@@ -1,8 +1,6 @@#ifndef REPOSITORY_H #define REPOSITORY_H -#include "path.h" -struct config_set ;struct fsmonitor_settings ;struct git_hash_algo ;
rerere.c +1 -0
@@ -14,6 +14,7 @@#include "resolve-undo.h" #include "ll-merge.h" #include "attr.h" +#include "path.h" #include "pathspec.h" #include "object-file.h" #include "object-store.h"
sequencer.c +1 -0
@@ -23,6 +23,7 @@#include "utf8.h" #include "cache-tree.h" #include "diff.h" +#include "path.h" #include "revision.h" #include "rerere.h" #include "merge.h"
server-info.c +1 -0
@@ -9,6 +9,7 @@#include "commit.h" #include "tag.h" #include "packfile.h" +#include "path.h" #include "object-file.h" #include "object-store.h" #include "server-info.h"
setup.c +1 -0
@@ -12,6 +12,7 @@#include "setup.h" #include "string-list.h" #include "chdir-notify.h" +#include "path.h" #include "promisor-remote.h" #include "quote.h" #include "trace2.h"
shallow.c +1 -0
@@ -11,6 +11,7 @@#include "remote.h" #include "refs.h" #include "oid-array.h" +#include "path.h" #include "diff.h" #include "revision.h" #include "commit-slab.h"
strbuf.c +1 -0
@@ -6,6 +6,7 @@#include "hex.h" #include "object-name.h" #include "refs.h" +#include "path.h" #include "repository.h" #include "string-list.h" #include "utf8.h"
submodule-config.c +1 -0
@@ -4,6 +4,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "path.h" #include "repository.h" #include "config.h" #include "submodule-config.h"
submodule.c +1 -0
@@ -20,6 +20,7 @@#include "strvec.h" #include "blob.h" #include "thread-utils.h" +#include "path.h" #include "quote.h" #include "remote.h" #include "worktree.h"
t/helper/test-ref-store.c +1 -0
@@ -4,6 +4,7 @@#include "setup.h" #include "worktree.h" #include "object-store.h" +#include "path.h" #include "repository.h" struct flag_definition {
tmp-objdir.c +1 -0
@@ -5,6 +5,7 @@#include "dir.h" #include "environment.h" #include "object-file.h" +#include "path.h" #include "sigchain.h" #include "string-list.h" #include "strbuf.h"
worktree.c +1 -0
@@ -3,6 +3,7 @@#include "alloc.h" #include "environment.h" #include "gettext.h" +#include "path.h" #include "repository.h" #include "refs.h" #include "setup.h"
wt-status.c +1 -0
@@ -9,6 +9,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" +#include "path.h" #include "revision.h" #include "diffcore.h" #include "quote.h"
Signature · 1 line
gitgitgadget
PATCH v2 20/27 diff.h: remove unnecessary include of oidset.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
This also made it clear that several .c files depended upon various things that oidset included, but had omitted the direct #include for those headers. Add those now.
--- add-interactive.c | 2 ++ add-patch.c | 1 + blame.h | 1 + builtin/add.c | 1 + builtin/diff-files.c | 1 + builtin/diff-index.c | 1 + builtin/merge-ours.c | 1 + builtin/patch-id.c | 1 + builtin/range-diff.c | 1 + builtin/reflog.c | 1 + builtin/reset.c | 1 + builtin/rev-parse.c | 1 + builtin/revert.c | 1 + builtin/shortlog.c | 1 + builtin/stash.c | 1 + diff-lib.c | 2 ++ diff.h | 4 +++- diffcore-break.c | 1 + diffcore-pickaxe.c | 1 + line-log.c | 1 + merge.c | 2 ++ patch-ids.c | 1 + pretty.c | 1 + range-diff.c | 1 + reflog-walk.c | 1 + t/helper/test-fast-rebase.c | 1 + t/helper/test-revision-walking.c | 1 + transport-helper.c | 1 + tree-diff.c | 1 + wt-status.c | 1 + 30 files changed, 35 insertions(+), 1 deletion(-)
add-interactive.c +2 -0
@@ -4,9 +4,11 @@#include "config.h" #include "diffcore.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "preload-index.h" #include "read-cache-ll.h" +#include "repository.h" #include "revision.h" #include "refs.h" #include "string-list.h"
add-patch.c +1 -0
@@ -7,6 +7,7 @@#include "gettext.h" #include "object-name.h" #include "read-cache-ll.h" +#include "repository.h" #include "strbuf.h" #include "run-command.h" #include "strvec.h"
blame.h +1 -0
@@ -2,6 +2,7 @@#define BLAME_H #include "commit.h" +#include "oidset.h" #include "xdiff-interface.h" #include "revision.h" #include "prio-queue.h"
builtin/add.c +1 -0
@@ -21,6 +21,7 @@#include "diff.h" #include "diffcore.h" #include "read-cache.h" +#include "repository.h" #include "revision.h" #include "bulk-checkin.h" #include "strvec.h"
builtin/diff-files.c +1 -0
@@ -9,6 +9,7 @@#include "diff-merges.h" #include "commit.h" #include "preload-index.h" +#include "repository.h" #include "revision.h" #include "submodule.h"
builtin/diff-index.c +1 -0
@@ -4,6 +4,7 @@#include "diff-merges.h" #include "commit.h" #include "preload-index.h" +#include "repository.h" #include "revision.h" #include "setup.h" #include "submodule.h"
builtin/merge-ours.c +1 -0
@@ -10,6 +10,7 @@#include "git-compat-util.h" #include "builtin.h" #include "diff.h" +#include "repository.h" static const char builtin_merge_ours_usage[] ="git merge-ours <base>... -- HEAD <remote>..." ;
builtin/patch-id.c +1 -0
@@ -2,6 +2,7 @@#include "config.h" #include "diff.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "parse-options.h"
builtin/range-diff.c +1 -0
@@ -4,6 +4,7 @@#include "parse-options.h" #include "range-diff.h" #include "config.h" +#include "repository.h" #include "revision.h" static const char *const builtin_range_diff_usage[] = {
builtin/reflog.c +1 -0
@@ -1,6 +1,7 @@#include "builtin.h" #include "config.h" #include "gettext.h" +#include "repository.h" #include "revision.h" #include "reachable.h" #include "worktree.h"
builtin/reset.c +1 -0
@@ -13,6 +13,7 @@#include "config.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "lockfile.h" #include "tag.h"
builtin/rev-parse.c +1 -0
@@ -11,6 +11,7 @@#include "commit.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "refs.h" #include "quote.h"
builtin/revert.c +1 -0
@@ -5,6 +5,7 @@#include "parse-options.h" #include "diff.h" #include "gettext.h" +#include "repository.h" #include "revision.h" #include "rerere.h" #include "dir.h"
builtin/shortlog.c +1 -0
@@ -5,6 +5,7 @@#include "environment.h" #include "gettext.h" #include "string-list.h" +#include "repository.h" #include "revision.h" #include "utf8.h" #include "mailmap.h"
builtin/stash.c +1 -0
@@ -4,6 +4,7 @@#include "config.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "object-name.h" #include "parse-options.h"
diff-lib.c +2 -0
@@ -7,6 +7,7 @@#include "diff.h" #include "diffcore.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "object-name.h" #include "read-cache.h"
@@ -14,6 +15,7 @@#include "cache-tree.h" #include "unpack-trees.h" #include "refs.h" +#include "repository.h" #include "submodule.h" #include "symlinks.h" #include "trace.h"
diff.h +3 -1
@@ -4,10 +4,12 @@#ifndef DIFF_H #define DIFF_H +#include "hash-ll.h" #include "pathspec.h" -#include "oidset.h" #include "strbuf.h" +struct oidset ; +/** * The diff API is for programs that compare two sets of files (e.g. two trees, * one tree and the index) and present the found difference in various ways.
diffcore-break.c +1 -0
@@ -4,6 +4,7 @@#include "git-compat-util.h" #include "diff.h" #include "diffcore.h" +#include "hash.h" #include "object.h" #include "promisor-remote.h"
diffcore-pickaxe.c +1 -0
@@ -7,6 +7,7 @@#include "diffcore.h" #include "xdiff-interface.h" #include "kwset.h" +#include "oidset.h" #include "pretty.h" #include "quote.h"
line-log.c +1 -0
@@ -8,6 +8,7 @@#include "diff.h" #include "commit.h" #include "decorate.h" +#include "repository.h" #include "revision.h" #include "xdiff-interface.h" #include "strbuf.h"
merge.c +2 -0
@@ -2,10 +2,12 @@#include "diff.h" #include "diffcore.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "lockfile.h" #include "merge.h" #include "commit.h" +#include "repository.h" #include "run-command.h" #include "resolve-undo.h" #include "tree.h"
patch-ids.c +1 -0
@@ -1,6 +1,7 @@#include "git-compat-util.h" #include "diff.h" #include "commit.h" +#include "hash.h" #include "hash-lookup.h" #include "hex.h" #include "patch-ids.h"
pretty.c +1 -0
@@ -4,6 +4,7 @@#include "commit.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "utf8.h" #include "diff.h"
range-diff.c +1 -0
@@ -13,6 +13,7 @@#include "commit.h" #include "pager.h" #include "pretty.h" +#include "repository.h" #include "userdiff.h" #include "apply.h" #include "revision.h"
reflog-walk.c +1 -0
@@ -3,6 +3,7 @@#include "commit.h" #include "refs.h" #include "diff.h" +#include "repository.h" #include "revision.h" #include "string-list.h" #include "reflog-walk.h"
t/helper/test-fast-rebase.c +1 -0
@@ -16,6 +16,7 @@#include "commit.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "lockfile.h" #include "merge-ort.h"
t/helper/test-revision-walking.c +1 -0
@@ -11,6 +11,7 @@#include "test-tool.h" #include "commit.h" #include "diff.h" +#include "repository.h" #include "revision.h" #include "setup.h"
transport-helper.c +1 -0
@@ -8,6 +8,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" +#include "repository.h" #include "revision.h" #include "remote.h" #include "string-list.h"
tree-diff.c +1 -0
@@ -4,6 +4,7 @@#include "git-compat-util.h" #include "diff.h" #include "diffcore.h" +#include "hash.h" #include "tree.h" #include "tree-walk.h"
wt-status.c +1 -0
@@ -7,6 +7,7 @@#include "diff.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "object-name.h" #include "path.h"
Signature · 1 line
gitgitgadget
PATCH v2 21/27 list-objects-filter-options.h: remove unneccessary include
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- list-objects-filter-options.h | 1 - 1 file changed, 1 deletion(-)
list-objects-filter-options.h +0 -1
@@ -3,7 +3,6 @@#include "gettext.h" #include "object.h" -#include "string-list.h" #include "strbuf.h" struct option ;
Signature · 1 line
gitgitgadget
PATCH v2 22/27 builtin.h: remove unneccessary includes
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
This also made it clear that a few .c files under builtin/ were depending upon some headers but had forgotten to #include them. Add the missing direct includes while at it.
--- builtin.h | 2 -- builtin/check-mailmap.c | 1 + builtin/commit-graph.c | 1 + builtin/config.c | 1 + builtin/credential-cache.c | 1 + builtin/for-each-ref.c | 1 + builtin/init-db.c | 1 + builtin/verify-pack.c | 1 + 8 files changed, 7 insertions(+), 2 deletions(-)
builtin.h +0 -2
@@ -2,8 +2,6 @@#define BUILTIN_H #include "git-compat-util.h" -#include "strbuf.h" -#include "commit.h" /* * builtin API
builtin/check-mailmap.c +1 -0
@@ -4,6 +4,7 @@#include "ident.h" #include "mailmap.h" #include "parse-options.h" +#include "strbuf.h" #include "string-list.h" #include "write-or-die.h"
builtin/commit-graph.c +1 -0
@@ -1,4 +1,5 @@#include "builtin.h" +#include "commit.h" #include "config.h" #include "dir.h" #include "environment.h"
builtin/config.c +1 -0
@@ -12,6 +12,7 @@#include "path.h" #include "quote.h" #include "setup.h" +#include "strbuf.h" #include "worktree.h" #include "wrapper.h"
builtin/credential-cache.c +1 -0
@@ -2,6 +2,7 @@#include "gettext.h" #include "parse-options.h" #include "path.h" +#include "strbuf.h" #include "wrapper.h" #include "write-or-die.h"
builtin/for-each-ref.c +1 -0
@@ -5,6 +5,7 @@#include "object.h" #include "parse-options.h" #include "ref-filter.h" +#include "strbuf.h" #include "strvec.h" #include "commit-reach.h"
builtin/init-db.c +1 -0
@@ -12,6 +12,7 @@#include "parse-options.h" #include "path.h" #include "setup.h" +#include "strbuf.h" #include "wrapper.h" static int guess_repository_type (const char *git_dir)
builtin/verify-pack.c +1 -0
@@ -3,6 +3,7 @@#include "gettext.h" #include "run-command.h" #include "parse-options.h" +#include "strbuf.h" #define VERIFY_PACK_VERBOSE 01#define VERIFY_PACK_STAT_ONLY 02
Signature · 1 line
gitgitgadget
PATCH v2 23/27 git-compat-util.h: remove unneccessary include of wildmatch.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The include of wildmatch.h in git-compat-util.h was added in cebcab189aa (Makefile: add USE_WILDMATCH to use wildmatch as fnmatch, 2013-01-01) as a way to be able to compile-time force any calls to fnmatch() to instead invoke wildmatch(). The defines and inline function were removed in 70a8fc999d9 (stop using fnmatch (either native or compat), 2014-02-15), and this include in git-compat-util.h has been unnecessary ever since.
Remove the include from git-compat-util.h, but add it to the .c files that had omitted the direct #include they needed.
--- apply.c | 1 + builtin/describe.c | 1 + builtin/ls-remote.c | 1 + builtin/name-rev.c | 1 + builtin/reflog.c | 1 + builtin/replace.c | 1 + builtin/show-branch.c | 1 + config.c | 1 + diffcore-order.c | 1 + fmt-merge-msg.c | 1 + git-compat-util.h | 2 -- log-tree.c | 1 + pathspec.c | 1 + refs.c | 1 + revision.c | 1 + t/helper/test-wildmatch.c | 1 + trace2/tr2_cfg.c | 1 + 17 files changed, 16 insertions(+), 2 deletions(-)
apply.c +1 -0
@@ -35,6 +35,7 @@#include "entry.h" #include "setup.h" #include "symlinks.h" +#include "wildmatch.h" #include "ws.h" #include "wrapper.h"
builtin/describe.c +1 -0
@@ -22,6 +22,7 @@#include "object-store.h" #include "list-objects.h" #include "commit-slab.h" +#include "wildmatch.h" #define MAX_TAGS (FLAG_BITS - 1)
builtin/ls-remote.c +1 -0
@@ -7,6 +7,7 @@#include "remote.h" #include "refs.h" #include "parse-options.h" +#include "wildmatch.h" static const char *const ls_remote_usage[] = { N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
builtin/name-rev.c +1 -0
@@ -15,6 +15,7 @@#include "hash-lookup.h" #include "commit-slab.h" #include "commit-graph.h" +#include "wildmatch.h" /* * One day. See the 'name a rev shortly after epoch' test in t6120 when
builtin/reflog.c +1 -0
@@ -4,6 +4,7 @@#include "repository.h" #include "revision.h" #include "reachable.h" +#include "wildmatch.h" #include "worktree.h" #include "reflog.h" #include "parse-options.h"
builtin/replace.c +1 -0
@@ -24,6 +24,7 @@#include "replace-object.h" #include "repository.h" #include "tag.h" +#include "wildmatch.h" static const char *const git_replace_usage[] = {N_ ("git replace [-f] <object> <replacement>" ),
builtin/show-branch.c +1 -0
@@ -14,6 +14,7 @@#include "dir.h" #include "commit-slab.h" #include "date.h" +#include "wildmatch.h" static const char * show_branch_usage[] = { N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
config.c +1 -0
@@ -36,6 +36,7 @@#include "setup.h" #include "strvec.h" #include "trace2.h" +#include "wildmatch.h" #include "worktree.h" #include "ws.h" #include "wrapper.h"
diffcore-order.c +1 -0
@@ -5,6 +5,7 @@#include "gettext.h" #include "diff.h" #include "diffcore.h" +#include "wildmatch.h" static char **order;static int order_cnt;
fmt-merge-msg.c +1 -0
@@ -15,6 +15,7 @@#include "fmt-merge-msg.h" #include "commit-reach.h" #include "gpg-interface.h" +#include "wildmatch.h" static int use_branch_desc;static int suppress_dest_pattern_seen;
git-compat-util.h +0 -2
@@ -625,8 +625,6 @@ static inline int git_has_dir_sep(const char *path)#include "compat/bswap.h" -#include "wildmatch.h" -struct strbuf ;/* General helper functions */
log-tree.c +1 -0
@@ -26,6 +26,7 @@#include "range-diff.h" #include "strmap.h" #include "tree.h" +#include "wildmatch.h" #include "write-or-die.h" static struct decoration name_decoration = {"object names" };
pathspec.c +1 -0
@@ -12,6 +12,7 @@#include "strvec.h" #include "symlinks.h" #include "quote.h" +#include "wildmatch.h" /* * Finds which of the given pathspecs match items in the index.
refs.c +1 -0
@@ -29,6 +29,7 @@#include "sigchain.h" #include "date.h" #include "commit.h" +#include "wildmatch.h" #include "wrapper.h" /*
revision.c +1 -0
@@ -46,6 +46,7 @@#include "list-objects-filter-options.h" #include "resolve-undo.h" #include "parse-options.h" +#include "wildmatch.h" volatile show_early_output_fn_t show_early_output;
t/helper/test-wildmatch.c +1 -0
@@ -1,4 +1,5 @@#include "test-tool.h" +#include "wildmatch.h" int cmd__wildmatch (int argc,const char **argv) {
trace2/tr2_cfg.c +1 -0
@@ -4,6 +4,7 @@#include "trace2.h" #include "trace2/tr2_cfg.h" #include "trace2/tr2_sysenv.h" +#include "wildmatch.h" static struct strbuf **tr2_cfg_patterns;static int tr2_cfg_count_patterns;
Signature · 1 line
gitgitgadget
PATCH v2 24/27 merge-ll: rename from ll-merge
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
A long term (but rather minor) pet-peeve of mine was the name ll-merge.[ch]. I thought it made it harder to realize what stuff was related to merging when I was working on the merge machinery and trying to improve it.
Further, back in d1cbe1e6d8a ("hash-ll.h: split out of hash.h to remove dependency on repository.h", 2023-04-22), we have split the portions of hash.h that do not depend upon repository.h into a "hash-ll.h" (due to the recommendation to use "ll" for "low-level" in its name[1], but which I used as a suffix precisely because of my distaste for "ll-merge"). When we discussed adding additional "*-ll.h" files, a request was made that we use "ll" consistently as either a prefix or a suffix. Since it is already in use as both a prefix and a suffix, the only way to do so is to rename some files.
Besides my distaste for the ll-merge.[ch] name, let me also note that the files
ll-fsmonitor.h, ll-hash.h, ll-merge.h, ll-object-store.h, ll-read-cache.h
would have essentially nothing to do with each other and make no sense to group. But giving them the common "ll-" prefix would group them. Using "-ll" as a suffix thus seems just much more logical to me. Rename ll-merge.[ch] to merge-ll.[ch] to achieve this consistency, and to ensure we get a more logical grouping of files.
[1] https://lore.kernel.org/git/[email protected]/
--- Documentation/technical/api-merge.txt | 4 ++-- Makefile | 2 +- apply.c | 2 +- builtin/checkout.c | 2 +- convert.c | 2 +- diff.c | 2 +- merge-blobs.c | 2 +- ll-merge.c => merge-ll.c | 2 +- ll-merge.h => merge-ll.h | 0 merge-ort.c | 2 +- merge-recursive.c | 2 +- notes-merge.c | 2 +- rerere.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) rename ll-merge.c => merge-ll.c (99%) rename ll-merge.h => merge-ll.h (100%)
Documentation/technical/api-merge.txt +2 -2
@@ -28,9 +28,9 @@ and `diff.c` for examples. * `struct ll_merge_options` -Check ll-merge.h for details. +Check merge-ll.h for details. Low-level (single file) merge ----------------------------- -Check ll-merge.h for details. +Check merge-ll.h for details.
Makefile +1 -1
@@ -1051,7 +1051,6 @@ LIB_OBJS += linear-assignment.o LIB_OBJS += list-objects-filter-options.o LIB_OBJS += list-objects-filter.o LIB_OBJS += list-objects.o -LIB_OBJS += ll-merge.o LIB_OBJS += lockfile.o LIB_OBJS += log-tree.o LIB_OBJS += ls-refs.o
@@ -1060,6 +1059,7 @@ LIB_OBJS += mailmap.o LIB_OBJS += match-trees.o LIB_OBJS += mem-pool.o LIB_OBJS += merge-blobs.o +LIB_OBJS += merge-ll.o LIB_OBJS += merge-ort.o LIB_OBJS += merge-ort-wrappers.o LIB_OBJS += merge-recursive.o
apply.c +1 -1
@@ -21,7 +21,7 @@#include "gettext.h" #include "hex.h" #include "xdiff-interface.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "lockfile.h" #include "name-hash.h" #include "object-name.h"
builtin/checkout.c +1 -1
@@ -13,7 +13,7 @@#include "gettext.h" #include "hex.h" #include "hook.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "lockfile.h" #include "mem-pool.h" #include "merge-recursive.h"
convert.c +1 -1
@@ -15,7 +15,7 @@#include "sub-process.h" #include "trace.h" #include "utf8.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "wrapper.h" /*
diff.c +1 -1
@@ -26,7 +26,7 @@#include "submodule.h" #include "hashmap.h" #include "mem-pool.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "string-list.h" #include "strvec.h" #include "graph.h"
merge-blobs.c +1 -1
@@ -1,7 +1,7 @@#include "git-compat-util.h" #include "run-command.h" #include "xdiff-interface.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "blob.h" #include "merge-blobs.h" #include "object-store.h"
merge-ll.c renamed from ll-merge.c +1 -1
@@ -10,7 +10,7 @@#include "attr.h" #include "xdiff-interface.h" #include "run-command.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "quote.h" #include "strbuf.h" #include "wrapper.h"
merge-ll.h renamed from ll-merge.h +0 -0
merge-ort.c +1 -1
@@ -30,7 +30,7 @@#include "gettext.h" #include "hex.h" #include "entry.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "match-trees.h" #include "mem-pool.h" #include "object-name.h"
merge-recursive.c +1 -1
@@ -20,7 +20,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "lockfile.h" #include "match-trees.h" #include "name-hash.h"
notes-merge.c +1 -1
@@ -12,7 +12,7 @@#include "diffcore.h" #include "hex.h" #include "xdiff-interface.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "dir.h" #include "notes.h" #include "notes-merge.h"
rerere.c +1 -1
@@ -12,7 +12,7 @@#include "xdiff-interface.h" #include "dir.h" #include "resolve-undo.h" -#include "ll-merge.h" +#include "merge-ll.h" #include "attr.h" #include "path.h" #include "pathspec.h"
Signature · 1 line
gitgitgadget
PATCH v2 25/27 khash: name the structs that khash declares
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
khash.h lets you instantiate custom hash types that map between two types. These are defined as a struct, as you might expect, and khash typedef's that to kh_foo_t. But it declares the struct anonymously, which doesn't give a name to the struct type itself; there is no "struct kh_foo". This has two small downsides:
- when using khash, we declare "kh_foo_t *the_foo". This is unlike our usual naming style, which is "struct kh_foo *the_foo".
- you can't forward-declare a typedef of an unnamed struct type in C. So we might do something like this in a header file:
struct kh_foo;
struct bar {
struct kh_foo *the_foo;
};
to avoid having to include the header that defines the real kh_foo. But that doesn't work with the typedef'd name. Without the "struct" keyword, the compiler doesn't know we mean that kh_foo is a type.
So let's always give khash structs the name that matches our conventions ("struct kh_foo" to match "kh_foo_t"). We'll keep doing the typedef to retain compatibility with existing callers.
--- khash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
khash.h +1 -1
@@ -62,7 +62,7 @@ static inline khint_t __ac_X31_hash_string(const char *s)static const double __ac_HASH_UPPER =0.77 ;#define __KHASH_TYPE (name, khkey_t, khval_t) \ - typedef struct { \ + typedef struct kh_##name { \ khint_t n_buckets, size, n_occupied, upper_bound; \ khint32_t *flags; \ khkey_t *keys; \
Signature · 1 line
gitgitgadget
PATCH v2 26/27 hash-ll, hashmap: move oidhash() to hash-ll
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
oidhash() was used by both hashmap and khash, which makes sense. However, the location of this function in hashmap.[ch] meant that khash.h had to depend upon hashmap.h, making people unfamiliar with khash think that it was built upon hashmap. (Or at least, I personally was confused for a while about this in the past.)
Move this function to hash-ll, so that khash.h can stop depending upon hashmap.h.
This has another benefit as well: it allows us to remove hashmap.h's dependency on hash-ll.h. While some callers of hashmap.h were making use of oidhash, most were not, so this change provides another way to reduce the number of includes.
Diff best viewed with --color-moved. Note that there's a small but important change to khash.h in this patch as well to allow this move, which is easy to overlook.
--- apply.c | 2 +- archive-tar.c | 2 +- archive-zip.c | 2 +- archive.c | 2 +- attr.c | 2 +- bisect.c | 2 +- blame.c | 2 +- builtin/blame.c | 2 +- builtin/cat-file.c | 2 +- builtin/checkout.c | 2 +- builtin/clone.c | 2 +- builtin/commit-graph.c | 2 +- builtin/commit-tree.c | 2 +- builtin/count-objects.c | 2 +- builtin/describe.c | 2 +- builtin/difftool.c | 2 +- builtin/fast-export.c | 2 +- builtin/fast-import.c | 2 +- builtin/fetch.c | 2 +- builtin/fsck.c | 2 +- builtin/gc.c | 2 +- builtin/grep.c | 2 +- builtin/hash-object.c | 3 +- builtin/index-pack.c | 3 +- builtin/log.c | 2 +- builtin/ls-tree.c | 2 +- builtin/merge-tree.c | 2 +- builtin/mktag.c | 3 +- builtin/mktree.c | 3 +- builtin/multi-pack-index.c | 3 +- builtin/notes.c | 2 +- builtin/pack-objects.c | 2 +- builtin/pack-redundant.c | 2 +- builtin/prune.c | 3 +- builtin/receive-pack.c | 2 +- builtin/remote.c | 2 +- builtin/repack.c | 2 +- builtin/replace.c | 2 +- builtin/rev-list.c | 2 +- builtin/show-ref.c | 2 +- builtin/submodule--helper.c | 2 +- builtin/tag.c | 2 +- builtin/unpack-file.c | 2 +- builtin/unpack-objects.c | 2 +- builtin/verify-commit.c | 2 +- bulk-checkin.c | 2 +- bundle-uri.c | 2 +- bundle.c | 2 +- cache-tree.c | 2 +- combine-diff.c | 2 +- commit-graph.c | 2 +- commit-graph.h | 2 +- commit.c | 2 +- config.c | 2 +- connected.c | 2 +- convert.c | 2 +- decorate.c | 1 - diagnose.c | 2 +- diff.c | 2 +- diffcore-rename.c | 2 +- dir.c | 2 +- dir.h | 1 + entry.c | 2 +- environment.c | 2 +- fetch-pack.c | 2 +- fmt-merge-msg.c | 2 +- fsck.c | 3 +- grep.c | 2 +- hash-ll.h | 19 ++ hashmap.h | 21 -- http-backend.c | 2 +- http-push.c | 2 +- http-walker.c | 2 +- http.c | 2 +- khash.h | 1 - list-objects-filter.c | 2 +- list-objects.c | 2 +- log-tree.c | 2 +- mailmap.c | 2 +- match-trees.c | 3 +- merge-blobs.c | 2 +- merge-ort.c | 2 +- merge-recursive.c | 2 +- midx.c | 2 +- notes-cache.c | 3 +- notes-merge.c | 2 +- notes.c | 2 +- object-name.c | 2 +- object-store-ll.h | 533 ++++++++++++++++++++++++++++++++++ object-store.h | 528 +-------------------------------- oss-fuzz/fuzz-pack-idx.c | 2 +- pack-bitmap-write.c | 2 +- pack-bitmap.c | 2 +- pack-check.c | 2 +- pack-mtimes.c | 3 +- pack-objects.h | 2 +- pack-revindex.c | 3 +- pack-write.c | 1 + packfile.c | 2 +- path.c | 2 +- promisor-remote.c | 2 +- protocol-caps.c | 2 +- prune-packed.c | 2 +- reachable.c | 2 +- read-cache.c | 2 +- ref-filter.c | 2 +- reflog.c | 2 +- refs.c | 2 +- remote.c | 2 +- remote.h | 1 + replace-object.c | 2 +- replace-object.h | 2 +- repository.c | 2 +- rerere.c | 2 +- revision.c | 2 +- send-pack.c | 2 +- sequencer.c | 2 +- serve.c | 1 + server-info.c | 2 +- shallow.c | 2 +- streaming.c | 2 +- submodule-config.c | 2 +- submodule.c | 2 +- t/helper/test-pack-mtimes.c | 2 +- t/helper/test-partial-clone.c | 2 +- t/helper/test-read-graph.c | 2 +- t/helper/test-read-midx.c | 2 +- t/helper/test-ref-store.c | 3 +- t/helper/test-repository.c | 2 +- tag.c | 2 +- tmp-objdir.c | 2 +- transport.c | 2 +- tree-walk.c | 2 +- tree.c | 2 +- unpack-trees.c | 2 +- upload-pack.c | 2 +- walker.c | 3 +- xdiff-interface.c | 3 +- 138 files changed, 699 insertions(+), 678 deletions(-) create mode 100644 object-store-ll.h
apply.c +1 -1
@@ -12,7 +12,7 @@#include "alloc.h" #include "base85.h" #include "config.h" -#include "object-store.h" +#include "object-store-ll.h" #include "blob.h" #include "delta.h" #include "diff.h"
archive-tar.c +1 -1
@@ -9,7 +9,7 @@#include "hex.h" #include "tar.h" #include "archive.h" -#include "object-store.h" +#include "object-store-ll.h" #include "streaming.h" #include "run-command.h" #include "write-or-die.h"
archive-zip.c +1 -1
@@ -9,7 +9,7 @@#include "hex.h" #include "streaming.h" #include "utf8.h" -#include "object-store.h" +#include "object-store-ll.h" #include "userdiff.h" #include "write-or-die.h" #include "xdiff-interface.h"
archive.c +1 -1
@@ -10,7 +10,7 @@#include "pretty.h" #include "setup.h" #include "refs.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "tree.h" #include "tree-walk.h"
attr.c +1 -1
@@ -19,7 +19,7 @@#include "quote.h" #include "read-cache-ll.h" #include "revision.h" -#include "object-store.h" +#include "object-store-ll.h" #include "setup.h" #include "thread-utils.h" #include "tree-walk.h"
bisect.c +1 -1
@@ -18,7 +18,7 @@#include "commit-slab.h" #include "commit-reach.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "dir.h"
blame.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "refs.h" -#include "object-store.h" +#include "object-store-ll.h" #include "cache-tree.h" #include "mergesort.h" #include "convert.h"
builtin/blame.c +1 -1
@@ -29,7 +29,7 @@#include "dir.h" #include "progress.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pager.h" #include "blame.h" #include "refs.h"
builtin/cat-file.c +1 -1
@@ -21,7 +21,7 @@#include "packfile.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "replace-object.h" #include "promisor-remote.h" #include "mailmap.h"
builtin/checkout.c +1 -1
@@ -18,7 +18,7 @@#include "mem-pool.h" #include "merge-recursive.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "parse-options.h" #include "path.h" #include "preload-index.h"
builtin/clone.c +1 -1
@@ -23,7 +23,7 @@#include "refs.h" #include "refspec.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "tree.h" #include "tree-walk.h" #include "unpack-trees.h"
builtin/commit-graph.c +1 -1
@@ -9,7 +9,7 @@#include "parse-options.h" #include "repository.h" #include "commit-graph.h" -#include "object-store.h" +#include "object-store-ll.h" #include "progress.h" #include "replace-object.h" #include "tag.h"
builtin/commit-tree.c +1 -1
@@ -8,7 +8,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "repository.h" #include "commit.h" #include "tree.h"
builtin/count-objects.c +1 -1
@@ -14,7 +14,7 @@#include "parse-options.h" #include "quote.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" static unsigned long garbage;static off_t size_garbage;
builtin/describe.c +1 -1
@@ -19,7 +19,7 @@#include "setup.h" #include "strvec.h" #include "run-command.h" -#include "object-store.h" +#include "object-store-ll.h" #include "list-objects.h" #include "commit-slab.h" #include "wildmatch.h"
builtin/difftool.c +1 -1
@@ -28,7 +28,7 @@#include "strbuf.h" #include "lockfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "dir.h" #include "entry.h" #include "setup.h"
builtin/fast-export.c +1 -1
@@ -10,7 +10,7 @@#include "refs.h" #include "refspec.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "object.h" #include "tag.h"
builtin/fast-import.c +1 -1
@@ -21,7 +21,7 @@#include "packfile.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "mem-pool.h" #include "commit-reach.h" #include "khash.h"
builtin/fetch.c +1 -1
@@ -11,7 +11,7 @@#include "refs.h" #include "refspec.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oidset.h" #include "oid-array.h" #include "commit.h"
builtin/fsck.c +1 -1
@@ -20,7 +20,7 @@#include "packfile.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "read-cache-ll.h" #include "replace-object.h"
builtin/gc.c +1 -1
@@ -27,7 +27,7 @@#include "commit-graph.h" #include "packfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pack.h" #include "pack-objects.h" #include "path.h"
builtin/grep.c +1 -1
@@ -27,7 +27,7 @@#include "submodule-config.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" #include "pager.h" #include "path.h"
builtin/hash-object.c +2 -1
@@ -10,12 +10,13 @@#include "gettext.h" #include "hex.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "blob.h" #include "quote.h" #include "parse-options.h" #include "exec-cmd.h" #include "setup.h" +#include "strbuf.h" #include "write-or-die.h" /*
builtin/index-pack.c +2 -1
@@ -14,12 +14,13 @@#include "progress.h" #include "fsck.h" #include "exec-cmd.h" +#include "strbuf.h" #include "streaming.h" #include "thread-utils.h" #include "packfile.h" #include "pack-revindex.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "replace-object.h" #include "promisor-remote.h"
builtin/log.c +1 -1
@@ -14,7 +14,7 @@#include "refs.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pager.h" #include "color.h" #include "commit.h"
builtin/ls-tree.c +1 -1
@@ -8,7 +8,7 @@#include "gettext.h" #include "hex.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "blob.h" #include "tree.h" #include "commit.h"
builtin/merge-tree.c +1 -1
@@ -9,7 +9,7 @@#include "commit-reach.h" #include "merge-ort.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "parse-options.h" #include "repository.h" #include "blob.h"
builtin/mktag.c +2 -1
@@ -2,10 +2,11 @@#include "gettext.h" #include "hex.h" #include "parse-options.h" +#include "strbuf.h" #include "tag.h" #include "replace-object.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "fsck.h" #include "config.h"
builtin/mktree.c +2 -1
@@ -8,9 +8,10 @@#include "gettext.h" #include "hex.h" #include "quote.h" +#include "strbuf.h" #include "tree.h" #include "parse-options.h" -#include "object-store.h" +#include "object-store-ll.h" static struct treeent { unsigned mode;
builtin/multi-pack-index.c +2 -1
@@ -5,8 +5,9 @@#include "gettext.h" #include "parse-options.h" #include "midx.h" +#include "strbuf.h" #include "trace2.h" -#include "object-store.h" +#include "object-store-ll.h" #define BUILTIN_MIDX_WRITE_USAGE \ N_("git multi-pack-index [<options>] write [--preferred-pack=<pack>]" \
builtin/notes.c +1 -1
@@ -14,7 +14,7 @@#include "hex.h" #include "notes.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "repository.h" #include "blob.h"
builtin/pack-objects.c +1 -1
@@ -34,7 +34,7 @@#include "list.h" #include "packfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "replace-object.h" #include "dir.h" #include "midx.h"
builtin/pack-redundant.c +1 -1
@@ -11,7 +11,7 @@#include "hex.h" #include "repository.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #define BLKSIZE 512
builtin/prune.c +2 -1
@@ -1,6 +1,7 @@#include "builtin.h" #include "commit.h" #include "diff.h" +#include "dir.h" #include "environment.h" #include "gettext.h" #include "hex.h"
@@ -13,7 +14,7 @@#include "replace-object.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "shallow.h" static const char *const prune_usage[] = {
builtin/receive-pack.c +1 -1
@@ -30,7 +30,7 @@#include "oidset.h" #include "packfile.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "protocol.h" #include "commit-reach.h"
builtin/remote.c +1 -1
@@ -11,7 +11,7 @@#include "rebase.h" #include "refs.h" #include "refspec.h" -#include "object-store.h" +#include "object-store-ll.h" #include "strvec.h" #include "commit-reach.h" #include "progress.h"
builtin/repack.c +1 -1
@@ -16,7 +16,7 @@#include "midx.h" #include "packfile.h" #include "prune-packed.h" -#include "object-store.h" +#include "object-store-ll.h" #include "promisor-remote.h" #include "shallow.h" #include "pack.h"
builtin/replace.c +1 -1
@@ -20,7 +20,7 @@#include "run-command.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "replace-object.h" #include "repository.h" #include "tag.h"
builtin/rev-list.c +1 -1
@@ -12,7 +12,7 @@#include "object.h" #include "object-name.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pack.h" #include "pack-bitmap.h" #include "log-tree.h"
builtin/show-ref.c +1 -1
@@ -4,7 +4,7 @@#include "hex.h" #include "refs.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "object.h" #include "tag.h" #include "string-list.h"
builtin/submodule--helper.c +1 -1
@@ -29,7 +29,7 @@#include "diff.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "advice.h" #include "branch.h" #include "list-objects-filter-options.h"
builtin/tag.c +1 -1
@@ -15,7 +15,7 @@#include "hex.h" #include "refs.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "tag.h" #include "run-command.h"
builtin/unpack-file.c +1 -1
@@ -2,7 +2,7 @@#include "config.h" #include "hex.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "wrapper.h" static char *create_temp_file (struct object_id *oid)
builtin/unpack-objects.c +1 -1
@@ -5,7 +5,7 @@#include "gettext.h" #include "git-zlib.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "object.h" #include "delta.h" #include "pack.h"
builtin/verify-commit.c +1 -1
@@ -9,7 +9,7 @@#include "config.h" #include "gettext.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "repository.h" #include "commit.h" #include "run-command.h"
bulk-checkin.c +1 -1
@@ -16,7 +16,7 @@#include "tmp-objdir.h" #include "packfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "wrapper.h" static int odb_transaction_nesting;
bundle-uri.c +1 -1
@@ -4,7 +4,7 @@#include "copy.h" #include "environment.h" #include "gettext.h" -#include "object-store.h" +#include "object-store-ll.h" #include "refs.h" #include "run-command.h" #include "hashmap.h"
bundle.c +1 -1
@@ -4,7 +4,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "repository.h" #include "object.h" #include "commit.h"
cache-tree.c +1 -1
@@ -8,7 +8,7 @@#include "cache-tree.h" #include "bulk-checkin.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "read-cache-ll.h" #include "replace-object.h" #include "promisor-remote.h"
combine-diff.c +1 -1
@@ -1,5 +1,5 @@#include "git-compat-util.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "convert.h" #include "blob.h"
commit-graph.c +1 -1
@@ -12,7 +12,7 @@#include "hash-lookup.h" #include "commit-graph.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "path.h" #include "alloc.h"
commit-graph.h +1 -1
@@ -1,7 +1,7 @@#ifndef COMMIT_GRAPH_H #define COMMIT_GRAPH_H -#include "object-store.h" +#include "object-store-ll.h" #include "oidset.h" #define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
commit.c +1 -1
@@ -7,7 +7,7 @@#include "hex.h" #include "repository.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pkt-line.h" #include "utf8.h" #include "diff.h"
config.c +1 -1
@@ -25,7 +25,7 @@#include "hashmap.h" #include "string-list.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pager.h" #include "path.h" #include "utf8.h"
connected.c +1 -1
@@ -1,7 +1,7 @@#include "git-compat-util.h" #include "gettext.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "run-command.h" #include "sigchain.h" #include "connected.h"
convert.c +1 -1
@@ -5,7 +5,7 @@#include "copy.h" #include "gettext.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "attr.h" #include "run-command.h" #include "quote.h"
decorate.c +0 -1
@@ -3,7 +3,6 @@* data. */ #include "git-compat-util.h" -#include "hashmap.h" #include "object.h" #include "decorate.h"
diagnose.c +1 -1
@@ -7,7 +7,7 @@#include "gettext.h" #include "hex.h" #include "strvec.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" #include "parse-options.h" #include "write-or-die.h"
diff.c +1 -1
@@ -20,7 +20,7 @@#include "attr.h" #include "run-command.h" #include "utf8.h" -#include "object-store.h" +#include "object-store-ll.h" #include "userdiff.h" #include "submodule-config.h" #include "submodule.h"
diffcore-rename.c +1 -1
@@ -6,7 +6,7 @@#include "alloc.h" #include "diff.h" #include "diffcore.h" -#include "object-store.h" +#include "object-store-ll.h" #include "hashmap.h" #include "mem-pool.h" #include "oid-array.h"
dir.c +1 -1
@@ -15,7 +15,7 @@#include "gettext.h" #include "name-hash.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "attr.h" #include "refs.h"
dir.h +1 -0
@@ -1,6 +1,7 @@#ifndef DIR_H #define DIR_H +#include "hash-ll.h" #include "hashmap.h" #include "pathspec.h" #include "statinfo.h"
entry.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "blob.h" -#include "object-store.h" +#include "object-store-ll.h" #include "dir.h" #include "environment.h" #include "gettext.h"
environment.c +1 -1
@@ -20,7 +20,7 @@#include "commit.h" #include "strvec.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "replace-object.h" #include "tmp-objdir.h"
fetch-pack.c +1 -1
@@ -24,7 +24,7 @@#include "oid-array.h" #include "oidset.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "connected.h" #include "fetch-negotiator.h"
fmt-merge-msg.c +1 -1
@@ -4,7 +4,7 @@#include "environment.h" #include "refs.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "diff.h" #include "diff-merges.h" #include "hex.h"
fsck.c +2 -1
@@ -1,8 +1,9 @@#include "git-compat-util.h" #include "alloc.h" #include "date.h" +#include "dir.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "repository.h" #include "object.h"
grep.c +1 -1
@@ -3,7 +3,7 @@#include "gettext.h" #include "grep.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pretty.h" #include "userdiff.h" #include "xdiff-interface.h"
hash-ll.h +19 -0
@@ -270,6 +270,25 @@ static inline void oid_set_algo(struct object_id *oid, const struct git_hash_alg oid->algo =hash_algo_by_ptr (algop); } +/* +* Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code +* for use in hash tables. Cryptographic hashes are supposed to have +* uniform distribution, so in contrast to `memhash()`, this just copies +* the first `sizeof(int)` bytes without shuffling any bits. Note that +* the results will be different on big-endian and little-endian +* platforms, so they should not be stored or transferred over the net. +*/ +static inline unsigned int oidhash (const struct object_id *oid) +{ +/* +* Equivalent to 'return *(unsigned int *)oid->hash;', but safe on +* platforms that don't support unaligned reads. +*/ +unsigned int hash; +memcpy (&hash, oid->hash,sizeof (hash)); +return hash; +} +const char *empty_tree_oid_hex (void );const char *empty_blob_oid_hex (void );
hashmap.h +0 -21
@@ -1,8 +1,6 @@#ifndef HASHMAP_H #define HASHMAP_H -#include "hash-ll.h" -/* * Generic implementation of hash-based key-value mappings. *
@@ -120,25 +118,6 @@ unsigned int memhash(const void *buf, size_t len);unsigned int memihash (const void *buf,size_t len);unsigned int memihash_cont (unsigned int hash_seed,const void *buf,size_t len); -/* -* Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code -* for use in hash tables. Cryptographic hashes are supposed to have -* uniform distribution, so in contrast to `memhash()`, this just copies -* the first `sizeof(int)` bytes without shuffling any bits. Note that -* the results will be different on big-endian and little-endian -* platforms, so they should not be stored or transferred over the net. -*/ -static inline unsigned int oidhash (const struct object_id *oid) -{ -/* -* Equivalent to 'return *(unsigned int *)oid->hash;', but safe on -* platforms that don't support unaligned reads. -*/ -unsigned int hash; -memcpy (&hash, oid->hash,sizeof (hash)); -return hash; -} -/* * struct hashmap_entry is an opaque structure representing an entry in the * hash table.
http-backend.c +1 -1
@@ -16,7 +16,7 @@#include "url.h" #include "strvec.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "protocol.h" #include "date.h" #include "wrapper.h"
http-push.c +1 -1
@@ -18,7 +18,7 @@#include "tree.h" #include "tree-walk.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit-reach.h" #ifdef EXPAT_NEEDS_XMLPARSE_H
http-walker.c +1 -1
@@ -7,7 +7,7 @@#include "list.h" #include "transport.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" struct alt_base {char *base;
http.c +1 -1
@@ -18,7 +18,7 @@#include "protocol.h" #include "string-list.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" static struct trace_key trace_curl =TRACE_KEY_INIT (CURL );static int trace_curl_data =1 ;
khash.h +0 -1
@@ -26,7 +26,6 @@#ifndef __AC_KHASH_H#define __AC_KHASH_H -#include "hashmap.h" #include "hash.h" #define AC_VERSION_KHASH_H "0.2.8"
list-objects-filter.c +1 -1
@@ -16,7 +16,7 @@#include "oidmap.h" #include "oidset.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" /* Remember to update object flag allocation in object.h */ /*
list-objects.c +1 -1
@@ -12,7 +12,7 @@#include "list-objects-filter.h" #include "list-objects-filter-options.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "trace.h" struct traversal_context {
log-tree.c +1 -1
@@ -5,7 +5,7 @@#include "environment.h" #include "hex.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "repository.h" #include "tmp-objdir.h" #include "commit.h"
mailmap.c +1 -1
@@ -3,7 +3,7 @@#include "string-list.h" #include "mailmap.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "setup.h" const char *git_mailmap_file;
match-trees.c +2 -1
@@ -1,9 +1,10 @@#include "git-compat-util.h" #include "hex.h" #include "match-trees.h" +#include "strbuf.h" #include "tree.h" #include "tree-walk.h" -#include "object-store.h" +#include "object-store-ll.h" static int score_missing (unsigned mode) {
merge-blobs.c +1 -1
@@ -4,7 +4,7 @@#include "merge-ll.h" #include "blob.h" #include "merge-blobs.h" -#include "object-store.h" +#include "object-store-ll.h" static int fill_mmfile_blob (mmfile_t *f,struct blob *obj) {
merge-ort.c +1 -1
@@ -34,7 +34,7 @@#include "match-trees.h" #include "mem-pool.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "path.h" #include "promisor-remote.h"
merge-recursive.c +1 -1
@@ -26,7 +26,7 @@#include "name-hash.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "repository.h" #include "revision.h"
midx.c +1 -1
@@ -9,7 +9,7 @@#include "lockfile.h" #include "packfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "hash-lookup.h" #include "midx.h" #include "progress.h"
notes-cache.c +2 -1
@@ -1,10 +1,11 @@#include "git-compat-util.h" #include "notes-cache.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pretty.h" #include "repository.h" #include "commit.h" #include "refs.h" +#include "strbuf.h" static int notes_cache_match_validity(struct repository *r, const char *ref,
notes-merge.c +1 -1
@@ -5,7 +5,7 @@#include "refs.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "repository.h" #include "diff.h"
notes.c +1 -1
@@ -4,7 +4,7 @@#include "hex.h" #include "notes.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "blob.h" #include "tree.h" #include "utf8.h"
object-name.c +1 -1
@@ -17,7 +17,7 @@#include "oidtree.h" #include "packfile.h" #include "pretty.h" -#include "object-store.h" +#include "object-store-ll.h" #include "read-cache-ll.h" #include "repository.h" #include "setup.h"
object-store-ll.h new file +533 -0
533 lines not on this page · raw message
object-store.h +1 -527
538 lines not on this page · raw message
oss-fuzz/fuzz-pack-idx.c +1 -1
@@ -1,5 +1,5 @@#include "git-compat-util.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" int LLVMFuzzerTestOneInput (const uint8_t *data,size_t size);
pack-bitmap-write.c +1 -1
@@ -3,7 +3,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "tag.h" #include "diff.h"
pack-bitmap.c +1 -1
@@ -17,7 +17,7 @@#include "repository.h" #include "trace2.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "list-objects-filter-options.h" #include "midx.h" #include "config.h"
pack-check.c +1 -1
@@ -7,7 +7,7 @@#include "progress.h" #include "packfile.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" struct idx_entry {off_t offset;
pack-mtimes.c +2 -1
@@ -2,8 +2,9 @@#include "gettext.h" #include "pack-mtimes.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" +#include "strbuf.h" static char *pack_mtimes_filename (struct packed_git *p) {
pack-objects.h +1 -1
@@ -1,7 +1,7 @@#ifndef PACK_OBJECTS_H #define PACK_OBJECTS_H -#include "object-store.h" +#include "object-store-ll.h" #include "thread-utils.h" #include "pack.h"
pack-revindex.c +2 -1
@@ -2,8 +2,9 @@#include "gettext.h" #include "pack-revindex.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" +#include "strbuf.h" #include "trace2.h" #include "config.h" #include "midx.h"
pack-write.c +1 -0
@@ -11,6 +11,7 @@#include "pack-objects.h" #include "pack-revindex.h" #include "path.h" +#include "strbuf.h" #include "wrapper.h" void reset_pack_idx_option (struct pack_idx_option *opts)
packfile.c +1 -1
@@ -19,7 +19,7 @@#include "tree-walk.h" #include "tree.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "midx.h" #include "commit-graph.h" #include "pack-revindex.h"
path.c +1 -1
@@ -15,7 +15,7 @@#include "submodule-config.h" #include "path.h" #include "packfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "lockfile.h" #include "exec-cmd.h" #include "wrapper.h"
promisor-remote.c +1 -1
@@ -1,7 +1,7 @@#include "git-compat-util.h" #include "gettext.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "promisor-remote.h" #include "config.h" #include "trace2.h"
protocol-caps.c +1 -1
@@ -7,7 +7,7 @@#include "hash-ll.h" #include "hex.h" #include "object.h" -#include "object-store.h" +#include "object-store-ll.h" #include "string-list.h" #include "strbuf.h"
prune-packed.c +1 -1
@@ -1,7 +1,7 @@#include "git-compat-util.h" #include "environment.h" #include "gettext.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" #include "progress.h" #include "prune-packed.h"
reachable.c +1 -1
@@ -13,7 +13,7 @@#include "list-objects.h" #include "packfile.h" #include "worktree.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pack-bitmap.h" #include "pack-mtimes.h"
read-cache.c +1 -1
@@ -17,7 +17,7 @@#include "refs.h" #include "dir.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "tree.h" #include "commit.h"
ref-filter.c +1 -1
@@ -8,7 +8,7 @@#include "refs.h" #include "wildmatch.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "repository.h" #include "commit.h"
reflog.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "gettext.h" -#include "object-store.h" +#include "object-store-ll.h" #include "reflog.h" #include "refs.h" #include "revision.h"
refs.c +1 -1
@@ -17,7 +17,7 @@#include "run-command.h" #include "hook.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "object.h" #include "path.h" #include "tag.h"
remote.c +1 -1
@@ -10,7 +10,7 @@#include "refs.h" #include "refspec.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "commit.h" #include "diff.h"
remote.h +1 -0
@@ -1,6 +1,7 @@#ifndef REMOTE_H #define REMOTE_H +#include "hash-ll.h" #include "hashmap.h" #include "refspec.h"
replace-object.c +1 -1
@@ -2,7 +2,7 @@#include "gettext.h" #include "hex.h" #include "oidmap.h" -#include "object-store.h" +#include "object-store-ll.h" #include "replace-object.h" #include "refs.h" #include "repository.h"
replace-object.h +1 -1
@@ -3,7 +3,7 @@#include "oidmap.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" /* * Do replace refs need to be checked this run? This variable is
repository.c +1 -1
@@ -6,7 +6,7 @@#include "git-compat-util.h" #include "abspath.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "config.h" #include "object.h" #include "lockfile.h"
rerere.c +1 -1
@@ -17,7 +17,7 @@#include "path.h" #include "pathspec.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "hash-lookup.h" #include "strmap.h" #include "wrapper.h"
revision.c +1 -1
@@ -6,7 +6,7 @@#include "hex.h" #include "object-name.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "tag.h" #include "blob.h" #include "tree.h"
send-pack.c +1 -1
@@ -5,7 +5,7 @@#include "gettext.h" #include "hex.h" #include "refs.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pkt-line.h" #include "sideband.h" #include "run-command.h"
sequencer.c +1 -1
@@ -11,7 +11,7 @@#include "dir.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "object.h" #include "pager.h" #include "commit.h"
serve.c +1 -0
@@ -1,6 +1,7 @@#include "git-compat-util.h" #include "repository.h" #include "config.h" +#include "hash-ll.h" #include "pkt-line.h" #include "version.h" #include "ls-refs.h"
server-info.c +1 -1
@@ -11,7 +11,7 @@#include "packfile.h" #include "path.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "server-info.h" #include "strbuf.h" #include "wrapper.h"
shallow.c +1 -1
@@ -4,7 +4,7 @@#include "repository.h" #include "tempfile.h" #include "lockfile.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "tag.h" #include "pkt-line.h"
streaming.c +1 -1
@@ -7,7 +7,7 @@#include "streaming.h" #include "repository.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "replace-object.h" #include "packfile.h" #include "wrapper.h"
submodule-config.c +1 -1
@@ -11,7 +11,7 @@#include "submodule.h" #include "strbuf.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "parse-options.h" #include "thread-utils.h" #include "tree-walk.h"
submodule.c +1 -1
@@ -27,7 +27,7 @@#include "parse-options.h" #include "object-file.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit-reach.h" #include "read-cache-ll.h" #include "setup.h"
t/helper/test-pack-mtimes.c +1 -1
@@ -1,7 +1,7 @@#include "test-tool.h" #include "hex.h" #include "strbuf.h" -#include "object-store.h" +#include "object-store-ll.h" #include "packfile.h" #include "pack-mtimes.h" #include "setup.h"
t/helper/test-partial-clone.c +1 -1
@@ -1,7 +1,7 @@#include "test-tool.h" #include "hex.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "setup.h" /*
t/helper/test-read-graph.c +1 -1
@@ -1,7 +1,7 @@#include "test-tool.h" #include "commit-graph.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "bloom.h" #include "setup.h"
t/helper/test-read-midx.c +1 -1
@@ -2,7 +2,7 @@#include "hex.h" #include "midx.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "pack-bitmap.h" #include "packfile.h" #include "setup.h"
t/helper/test-ref-store.c +2 -1
@@ -3,9 +3,10 @@#include "refs.h" #include "setup.h" #include "worktree.h" -#include "object-store.h" +#include "object-store-ll.h" #include "path.h" #include "repository.h" +#include "strbuf.h" struct flag_definition {const char *name;
t/helper/test-repository.c +1 -1
@@ -4,7 +4,7 @@#include "config.h" #include "environment.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" #include "object.h" #include "repository.h" #include "setup.h"
tag.c +1 -1
@@ -2,7 +2,7 @@#include "environment.h" #include "tag.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" #include "tree.h" #include "blob.h"
tmp-objdir.c +1 -1
@@ -11,7 +11,7 @@#include "strbuf.h" #include "strvec.h" #include "quote.h" -#include "object-store.h" +#include "object-store-ll.h" struct tmp_objdir {struct strbuf path;
transport.c +1 -1
@@ -27,7 +27,7 @@#include "transport-internal.h" #include "protocol.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "color.h" #include "bundle-uri.h" #include "wrapper.h"
tree-walk.c +1 -1
@@ -5,7 +5,7 @@#include "gettext.h" #include "hex.h" #include "object-file.h" -#include "object-store.h" +#include "object-store-ll.h" #include "trace2.h" #include "tree.h" #include "pathspec.h"
tree.c +1 -1
@@ -3,7 +3,7 @@#include "hex.h" #include "tree.h" #include "object-name.h" -#include "object-store.h" +#include "object-store-ll.h" #include "blob.h" #include "commit.h" #include "tag.h"
unpack-trees.c +1 -1
@@ -23,7 +23,7 @@#include "symlinks.h" #include "trace2.h" #include "fsmonitor.h" -#include "object-store.h" +#include "object-store-ll.h" #include "promisor-remote.h" #include "entry.h" #include "parallel-checkout.h"
upload-pack.c +1 -1
@@ -7,7 +7,7 @@#include "pkt-line.h" #include "sideband.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "oid-array.h" #include "tag.h" #include "object.h"
walker.c +2 -1
@@ -3,8 +3,9 @@#include "hex.h" #include "walker.h" #include "repository.h" -#include "object-store.h" +#include "object-store-ll.h" #include "commit.h" +#include "strbuf.h" #include "tree.h" #include "tree-walk.h" #include "tag.h"
xdiff-interface.c +2 -1
@@ -1,7 +1,8 @@#include "git-compat-util.h" #include "config.h" #include "hex.h" -#include "object-store.h" +#include "object-store-ll.h" +#include "strbuf.h" #include "xdiff-interface.h" #include "xdiff/xtypes.h" #include "xdiff/xdiffi.h"
Signature · 1 line
gitgitgadget
Re: [PATCH v2 26/27] hash-ll, hashmap: move oidhash() to hash-ll
Quoted 2 lines · Elijah Newren via GitGitGadget
Move this function to hash-ll, so that
khash.hcan stop depending uponhashmap.h.
[snip]
Quoted 3 lines
Diff best viewed with
--color-moved. Note that there's a small but important change tokhash.hin this patch as well to allow this move, which is easy to overlook.
[snip]
khash.h line 29
Quoted 10 lines
khash.h +0
-1@@ -26,7 +26,6 @@#ifndef __AC_KHASH_H#define __AC_KHASH_H -#include "hashmap.h" #include "hash.h"
Is this the small but important change to khash.h? I thought that this is the reason for the change, not what "allow[ed]" this move.
Quoted 4 lines
object-name.c +0
-0
[snip]
object-name.c
Quoted 9 lines
object-name.c +9
-0+struct raw_object_store { +/* +* Set of all object directories; the main directory is first (and +* cannot be NULL after initialization). Subsequent directories are +* alternates. +*/ +struct object_directory *odb; +struct object_directory **odb_tail; +struct kh_odb_path_map *odb_by_path;
This is not present as a minus line (that line uses kh_odb_path_map_t). I thought this was so that we could forward declare "struct kh_odb_path_map", but I don't see such a forward declaration. (Was it declared elsewhere?)
Everything else looks good.
Re: [PATCH v2 26/27] hash-ll, hashmap: move oidhash() to hash-ll
Quoted 22 lines · Jonathan Tan
Quoted 2 lines · Elijah Newren via GitGitGadget
Move this function to hash-ll, so that
khash.hcan stop depending uponhashmap.h.[snip]
Quoted 3 lines
Diff best viewed with
--color-moved. Note that there's a small but important change tokhash.hin this patch as well to allow this move, which is easy to overlook.[snip]
Quoted 8 lines
khash.h +0
-0@@ -26,7 +26,6 @@#ifndef __AC_KHASH_H#define __AC_KHASH_H
Quoted 5 lines
khash.h line 29
Quoted 2 lines
khash.h +0
-1-#include "hashmap.h" #include "hash.h" Is this the small but important change to
khash.h? I thought that this is the reason for the change, not what "allow[ed]" this move.
No, the small but important change to khash.h was only in v1, and was split out into a separate patch based on feedback. I just forgot to update this commit's message when I did so. Sorry about that; I'll fix it up.
Quoted 18 lines
Quoted 5 lines
object-name.c +0
-0[snip]
object-name.c
Quoted 9 lines
object-name.c +9
-0+struct raw_object_store { +/* +* Set of all object directories; the main directory is first (and +* cannot be NULL after initialization). Subsequent directories are +* alternates. +*/ +struct object_directory *odb; +struct object_directory **odb_tail; +struct kh_odb_path_map *odb_by_path;
Quoted 4 lines
This is not present as a minus line (that line uses
kh_odb_path_map_t). I thought this was so that we could forward declare "structkh_odb_path_map", but I don't see such a forward declaration. (Was it declared elsewhere?)
I think this hunk probably should have been part of the khash.h patch that was separated out, to make it more clear. I'll fix that up.
Quoted 1 line
Everything else looks good.
Thanks, but I realized some point on Saturday that this patch was an accidental squash of two patches -- one splitting object-store-ll.h out of object-store.h (the majority of the patch), and the other about the hash-ll/hashmap/khash changes. I'll split it back out in my re-roll. There won't be any code changes, just splitting the patch into its individual parts.
PATCH v2 27/27 fsmonitor-ll.h: split this header out of fsmonitor.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
This creates a new fsmonitor-ll.h with most of the functions from fsmonitor.h, though it leaves three inline functions where they were. Two-thirds of the files that previously included fsmonitor.h did not need those three inline functions or the six extra includes those inline functions required, so this allows them to only include the lower level header.
Diff best viewed with --color-moved.
--- builtin/fsmonitor--daemon.c | 4 +- compat/fsmonitor/fsm-health-darwin.c | 2 +- compat/fsmonitor/fsm-health-win32.c | 2 +- compat/fsmonitor/fsm-ipc-darwin.c | 2 +- compat/fsmonitor/fsm-listen-darwin.c | 3 +- compat/fsmonitor/fsm-listen-win32.c | 2 +- compat/fsmonitor/fsm-path-utils-darwin.c | 3 +- compat/fsmonitor/fsm-path-utils-win32.c | 3 +- compat/fsmonitor/fsm-settings-darwin.c | 2 +- compat/fsmonitor/fsm-settings-win32.c | 2 +- dir.c | 3 +- fsmonitor-ipc.c | 2 +- fsmonitor-ll.h | 52 ++++++++++++++++++++++++ fsmonitor.h | 46 +-------------------- sparse-index.c | 3 +- 15 files changed, 73 insertions(+), 58 deletions(-) create mode 100644 fsmonitor-ll.h
builtin/fsmonitor--daemon.c +3 -1
@@ -5,15 +5,17 @@#include "environment.h" #include "gettext.h" #include "parse-options.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-ipc.h" #include "fsmonitor-path-utils.h" +#include "fsmonitor-settings.h" #include "compat/fsmonitor/fsm-health.h" #include "compat/fsmonitor/fsm-listen.h" #include "fsmonitor--daemon.h" #include "simple-ipc.h" #include "khash.h" #include "pkt-line.h" +#include "trace.h" #include "trace2.h" static const char *const builtin_fsmonitor__daemon_usage[] = {
compat/fsmonitor/fsm-health-darwin.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "config.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsm-health.h" #include "fsmonitor--daemon.h"
compat/fsmonitor/fsm-health-win32.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "config.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsm-health.h" #include "fsmonitor--daemon.h" #include "gettext.h"
compat/fsmonitor/fsm-ipc-darwin.c +1 -1
@@ -5,7 +5,7 @@#include "path.h" #include "repository.h" #include "strbuf.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-ipc.h" #include "fsmonitor-path-utils.h"
compat/fsmonitor/fsm-listen-darwin.c +2 -1
@@ -24,12 +24,13 @@#endif #include "git-compat-util.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsm-listen.h" #include "fsmonitor--daemon.h" #include "fsmonitor-path-utils.h" #include "gettext.h" #include "string-list.h" +#include "trace.h" struct fsm_listen_data {
compat/fsmonitor/fsm-listen-win32.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "config.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsm-listen.h" #include "fsmonitor--daemon.h" #include "gettext.h"
compat/fsmonitor/fsm-path-utils-darwin.c +2 -1
@@ -1,7 +1,8 @@#include "git-compat-util.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-path-utils.h" #include "gettext.h" +#include "trace.h" #include <dirent.h> #include <errno.h> #include <fcntl.h>
compat/fsmonitor/fsm-path-utils-win32.c +2 -1
@@ -1,7 +1,8 @@#include "git-compat-util.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-path-utils.h" #include "gettext.h" +#include "trace.h" /* * Check remote working directory protocol.
compat/fsmonitor/fsm-settings-darwin.c +1 -1
@@ -1,6 +1,6 @@#include "git-compat-util.h" #include "config.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-ipc.h" #include "fsmonitor-settings.h" #include "fsmonitor-path-utils.h"
compat/fsmonitor/fsm-settings-win32.c +1 -1
@@ -1,7 +1,7 @@#include "git-compat-util.h" #include "config.h" #include "repository.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "fsmonitor-settings.h" #include "fsmonitor-path-utils.h"
dir.c +2 -1
@@ -24,7 +24,8 @@#include "utf8.h" #include "varint.h" #include "ewah/ewok.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" +#include "read-cache-ll.h" #include "setup.h" #include "sparse-index.h" #include "submodule-config.h"
fsmonitor-ipc.c +1 -1
@@ -1,5 +1,5 @@#include "git-compat-util.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" #include "gettext.h" #include "simple-ipc.h" #include "fsmonitor-ipc.h"
fsmonitor-ll.h new file +52 -0
52 lines not on this page · raw message
fsmonitor.h +1 -45
58 lines not on this page · raw message
sparse-index.c +2 -1
@@ -3,6 +3,7 @@#include "environment.h" #include "gettext.h" #include "name-hash.h" +#include "read-cache-ll.h" #include "repository.h" #include "sparse-index.h" #include "tree.h"
@@ -11,7 +12,7 @@#include "cache-tree.h" #include "config.h" #include "dir.h" -#include "fsmonitor.h" +#include "fsmonitor-ll.h" struct modify_index_context {struct index_state *write;
Signature · 1 line
gitgitgadget
Re: [PATCH v2 27/27] fsmonitor-ll.h: split this header out of fsmonitor.h
Quoted 9 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
This creates a new
fsmonitor-ll.hwith most of the functions fromfsmonitor.h, though it leaves three inline functions where they were. Two-thirds of the files that previously includedfsmonitor.hdid not need those three inline functions or the six extra includes those inline functions required, so this allows them to only include the lower level header.
Quoted 3 lines
Diff best viewed with
--color-moved.Signed-off-by Elijah Newren <[email protected]>
Looks good. Thanks for this significant effort.
Re: [PATCH v2 27/27] fsmonitor-ll.h: split this header out of fsmonitor.h
Quoted 11 lines · Jonathan Tan
Quoted 9 lines · Elijah Newren via GitGitGadget
From: Elijah Newren <[email protected]>
This creates a new
fsmonitor-ll.hwith most of the functions fromfsmonitor.h, though it leaves three inline functions where they were. Two-thirds of the files that previously includedfsmonitor.hdid not need those three inline functions or the six extra includes those inline functions required, so this allows them to only include the lower level header.
Quoted 5 lines
Quoted 3 lines
Diff best viewed with
--color-moved.Signed-off-by Elijah Newren <[email protected]>Looks good. Thanks for this significant effort.
Thanks for the review!
v3 cover Header cleanups (final splitting of cache.h, and some splitting of other headers)
In reply to Elijah Newren via GitGitGadget== Summary ==
This series continues to focus on splitting declarations from cache.h to separate headers, and also cleans up some other small header issues. By patch 17, cache.h is gone.
== Changes ==
Since v2 (thanks to Jonathan Tan for feedback and suggestions!)
* Wording fixes & improvements suggested by Jonathan
* Pulled another line from the oidhash() patch (27) into the khash patch
(25) to make it easier to review
* Split the old patch 26 into two. Somehow my object-ll and hash-ll changes got smashed into the same patch (before v1), and I didn't notice until after v2 was sent out. Split them out two separate patches to make them easier to review.
Since v1 (thanks to Calvin, Glen, Junio, and Peff for feedback and suggestions!)
* Split the first patch into two, correct the explanation around existing bug, and tweak how global is removed
* New patch 24 to rename ll-merge.[ch] to merge-ll.[ch]
* Patch 25 split out of the old patch 23 to document the khash.h change in isolation
== Reviewer Focus (see also "Overview" section, below) ==
While the series may look long and big, it's really mostly just (a) moving lots of code (so --color-moved is handy), and (b) adding (or removing) includes repeatedly throughout the code. These are just more of the same kinds of changes from the previous series.
However, there are a few exceptions that do not fit in these two categories, which should be reviewed more closely:
* Patches 1-3 & 6
* Patch 17, the Documentation and Makefile changes
* Patch 24 & 27
Patches 11 & 28 might also merit a little closer review.
== Maintainer notes from v1 ==
(1) This series is built on top of a merge of en/header-split-cache-h-part-2 into master, (2) This series has no conflicts with next, but has three simple & small conflicts with seen:
* a textual conflict with tl/notes-separator (affecting builtin/notes.c; to address, nuke the conflict region and add an include of alloc.h after builtin.h)
* a textual & semantic conflict with cw/strbuf-cleanup (affecting strbuf.c; to address, delete the conflict region and also delete the include of repository.h)
* a semantic conflict with rn/sparse-diff-index (affecting builtin/diff-index.c; to address, add an include of sparse-index.h).
== Impact; interesting stats ==
By way of impact, I created a small script which before this series reports:
Total include depth of .c files: 18340
Total include depth of .h files: 1385
After this series, I see:
Total include depth of .c files: 16155
Total include depth of .h files: 1206
The script computes the number of files transitively included by each file (not perfect, e.g. only does textual search so if the include if ifdef'd, it'll be counted anyway), and then sums the results. I think these numbers represent one rough measure of overall complexity humans face in understanding files in our project, and/or that compilers take to operate. (For reference, the total include depths for v2.40.0 were 23114 and 2981; we've come a long way in improving it, most of that through nuking cache.h.)
== Overview ==
An overview:
* Patches 1-7: move shared code between various builtin/*.c files into alternate shared homes (setup.c, read-cache.c).
* Patches 8-17: continue splitting declarations from cache.h into alternative headers associated with the actual implementation of those functions.
* Patches 18-23: remove some unnecessary includes in other header files
* Patch 24: rename ll-merge for consistency, and to get a better name
* Patches 25-28: do some header shuffling with hashmap/khash/hash, and fsmonitor to reduce include depths
I would have just lumped patches 1-7 in with 8-17, but patches 1-3, & 6 did some preliminary changes to allow the code movement.
== Acknowledgements ==
And thanks once again to Dscho for gitgitgadget. Getting multiple platform testing + all the special tests (sparse, cocci, hdr-check, etc.) really helps clean out all the issues that would otherwise hit a series like this.
Elijah Newren (28):
init-db: document existing bug with core.bare in template config
init-db: remove unnecessary global variable
init-db, clone: change unnecessary global into passed parameter
setup: adopt shared init-db & clone code
read-cache: move shared commit and ls-files code
add: modify add_files_to_cache() to avoid globals
read-cache: move shared add/checkout/commit code
statinfo: move stat_{data,validity} functions from cache/read-cache run-command.h: move declarations for run-command.c from cache.h name-hash.h: move declarations for name-hash.c from cache.h sparse-index.h: move declarations for sparse-index.c from cache.h preload-index.h: move declarations for preload-index.c from elsewhere diff.h: move declaration for global in diff.c from cache.h merge.h: move declarations for merge.c from cache.h repository.h: move declaration of the_index from cache.h read-cache*.h: move declarations for read-cache.c functions from
cache.h
cache.h: remove this no-longer-used header
log-tree: replace include of revision.h with simple forward
declaration
repository: remove unnecessary include of path.h
diff.h: remove unnecessary include of oidset.h list-objects-filter-options.h: remove unneccessary include builtin.h: remove unneccessary includes
git-compat-util.h: remove unneccessary include of wildmatch.h
merge-ll: rename from ll-merge
khash: name the structs that khash declares object-store-ll.h: split this header out of object-store.h hash-ll, hashmap: move oidhash() to hash-ll fsmonitor-ll.h: split this header out of fsmonitor.h
Documentation/CodingGuidelines | 2 +- Documentation/MyFirstObjectWalk.txt | 2 +- Documentation/technical/api-merge.txt | 4 +- Documentation/user-manual.txt | 18 +- Makefile | 5 +- add-interactive.c | 6 +- add-patch.c | 4 +- apply.c | 10 +- archive-tar.c | 2 +- archive-zip.c | 2 +- archive.c | 3 +- attr.c | 6 +- bisect.c | 3 +- blame.c | 6 +- blame.h | 1 + branch.c | 1 + builtin.h | 3 - builtin/add.c | 105 +---- builtin/am.c | 5 +- builtin/apply.c | 1 - builtin/archive.c | 1 - builtin/bisect.c | 2 +- builtin/blame.c | 2 +- builtin/branch.c | 4 +- builtin/bundle.c | 1 - builtin/cat-file.c | 5 +- builtin/check-attr.c | 1 - builtin/check-ignore.c | 1 - builtin/check-mailmap.c | 1 + builtin/check-ref-format.c | 3 +- builtin/checkout--worker.c | 1 + builtin/checkout-index.c | 2 + builtin/checkout.c | 9 +- builtin/clean.c | 3 +- builtin/clone.c | 6 +- builtin/column.c | 1 - builtin/commit-graph.c | 3 +- builtin/commit-tree.c | 5 +- builtin/commit.c | 10 +- builtin/config.c | 1 + builtin/count-objects.c | 6 +- builtin/credential-cache.c | 1 + builtin/describe.c | 7 +- builtin/diff-files.c | 5 +- builtin/diff-index.c | 5 +- builtin/diff-tree.c | 5 +- builtin/diff.c | 5 +- builtin/difftool.c | 7 +- builtin/fast-export.c | 3 +- builtin/fast-import.c | 4 +- builtin/fetch.c | 6 +- builtin/for-each-ref.c | 2 +- builtin/for-each-repo.c | 3 +- builtin/fsck.c | 6 +- builtin/fsmonitor--daemon.c | 4 +- builtin/gc.c | 3 +- builtin/get-tar-commit-id.c | 3 +- builtin/grep.c | 7 +- builtin/hash-object.c | 3 +- builtin/help.c | 3 +- builtin/hook.c | 1 - builtin/index-pack.c | 3 +- builtin/init-db.c | 474 +------------------- builtin/interpret-trailers.c | 1 - builtin/log.c | 2 +- builtin/ls-files.c | 143 +----- builtin/ls-remote.c | 2 +- builtin/ls-tree.c | 6 +- builtin/mailinfo.c | 3 +- builtin/mailsplit.c | 1 - builtin/merge-base.c | 1 - builtin/merge-file.c | 1 - builtin/merge-index.c | 2 + builtin/merge-ours.c | 1 + builtin/merge-recursive.c | 1 - builtin/merge-tree.c | 2 +- builtin/merge.c | 5 +- builtin/mktag.c | 3 +- builtin/mktree.c | 3 +- builtin/multi-pack-index.c | 4 +- builtin/mv.c | 2 + builtin/name-rev.c | 1 + builtin/notes.c | 6 +- builtin/pack-objects.c | 2 +- builtin/pack-redundant.c | 2 +- builtin/patch-id.c | 2 +- builtin/prune.c | 7 +- builtin/pull.c | 6 +- builtin/push.c | 3 +- builtin/range-diff.c | 2 +- builtin/read-tree.c | 4 +- builtin/rebase.c | 1 + builtin/receive-pack.c | 3 +- builtin/reflog.c | 2 + builtin/remote.c | 3 +- builtin/repack.c | 3 +- builtin/replace.c | 7 +- builtin/rerere.c | 1 - builtin/reset.c | 3 + builtin/rev-list.c | 5 +- builtin/rev-parse.c | 6 +- builtin/revert.c | 1 + builtin/rm.c | 2 + builtin/shortlog.c | 2 +- builtin/show-branch.c | 4 +- builtin/show-index.c | 1 - builtin/show-ref.c | 3 +- builtin/sparse-checkout.c | 1 - builtin/stash.c | 4 + builtin/stripspace.c | 1 - builtin/submodule--helper.c | 7 +- builtin/symbolic-ref.c | 1 - builtin/tag.c | 6 +- builtin/unpack-file.c | 2 +- builtin/unpack-objects.c | 3 +- builtin/update-index.c | 5 +- builtin/update-ref.c | 3 +- builtin/update-server-info.c | 3 +- builtin/upload-archive.c | 2 +- builtin/upload-pack.c | 2 +- builtin/verify-commit.c | 5 +- builtin/verify-pack.c | 2 +- builtin/verify-tag.c | 3 +- builtin/worktree.c | 5 +- builtin/write-tree.c | 1 - bulk-checkin.c | 2 +- bundle-uri.c | 2 +- bundle.c | 2 +- cache-tree.c | 5 +- combine-diff.c | 2 +- commit-graph.c | 3 +- commit-graph.h | 2 +- commit.c | 2 +- compat/fsmonitor/fsm-health-darwin.c | 2 +- compat/fsmonitor/fsm-health-win32.c | 4 +- compat/fsmonitor/fsm-ipc-darwin.c | 3 +- compat/fsmonitor/fsm-listen-darwin.c | 3 +- compat/fsmonitor/fsm-listen-win32.c | 4 +- compat/fsmonitor/fsm-path-utils-darwin.c | 4 +- compat/fsmonitor/fsm-path-utils-win32.c | 5 +- compat/fsmonitor/fsm-settings-darwin.c | 2 +- compat/fsmonitor/fsm-settings-win32.c | 4 +- compat/mingw.c | 1 - compat/precompose_utf8.c | 3 +- compat/sha1-chunked.c | 3 +- compat/simple-ipc/ipc-win32.c | 2 +- compat/win32/trace2_win32_process_info.c | 2 +- config.c | 5 +- connect.c | 1 + connected.c | 2 +- convert.c | 7 +- decorate.c | 1 - diagnose.c | 2 +- diff-lib.c | 5 +- diff.c | 7 +- diff.h | 6 +- diffcore-break.c | 4 +- diffcore-order.c | 1 + diffcore-pickaxe.c | 1 + diffcore-rename.c | 2 +- dir.c | 8 +- dir.h | 1 + entry.c | 6 +- environment.c | 5 +- environment.h | 3 +- exec-cmd.c | 3 +- fetch-pack.c | 3 +- fmt-merge-msg.c | 3 +- fsck.c | 4 +- fsmonitor-ipc.c | 4 +- fsmonitor-ll.h | 52 +++ fsmonitor.c | 2 +- fsmonitor.h | 49 +-- git-compat-util.h | 2 - git.c | 1 + grep.c | 2 +- hash-ll.h | 19 + hash-lookup.c | 3 +- hashmap.h | 21 - http-backend.c | 3 +- http-push.c | 2 +- http-walker.c | 2 +- http.c | 2 +- khash.h | 3 +- line-log.c | 1 + list-objects-filter-options.h | 1 - list-objects-filter.c | 2 +- list-objects.c | 2 +- log-tree.c | 4 +- log-tree.h | 2 +- mailmap.c | 2 +- match-trees.c | 3 +- merge-blobs.c | 4 +- ll-merge.c => merge-ll.c | 2 +- ll-merge.h => merge-ll.h | 0 merge-ort-wrappers.c | 3 +- merge-ort.c | 9 +- merge-recursive.c | 9 +- merge.c | 5 +- merge.h | 17 + midx.c | 2 +- name-hash.c | 5 +- name-hash.h | 16 + notes-cache.c | 3 +- notes-merge.c | 5 +- notes.c | 2 +- object-file.c | 1 + object-name.c | 5 +- object-store-ll.h | 533 +++++++++++++++++++++++ object-store.h | 528 +--------------------- object.c | 3 +- oidmap.h | 1 + oss-fuzz/fuzz-pack-idx.c | 2 +- pack-bitmap-write.c | 3 +- pack-bitmap.c | 2 +- pack-check.c | 2 +- pack-mtimes.c | 3 +- pack-objects.h | 2 +- pack-revindex.c | 3 +- pack-write.c | 2 + packfile.c | 2 +- parallel-checkout.c | 3 +- patch-ids.c | 1 + path.c | 2 +- pathspec.c | 4 +- preload-index.c | 4 +- preload-index.h | 15 + pretty.c | 1 + promisor-remote.c | 2 +- protocol-caps.c | 2 +- prune-packed.c | 2 +- range-diff.c | 1 + reachable.c | 2 +- cache.h => read-cache-ll.h | 148 +------ read-cache.c | 331 ++++++++++---- read-cache.h | 45 ++ ref-filter.c | 2 +- reflog-walk.c | 1 + reflog.c | 2 +- refs.c | 4 +- refs/files-backend.c | 3 +- refs/packed-backend.c | 3 +- remote.c | 3 +- remote.h | 1 + replace-object.c | 2 +- replace-object.h | 2 +- repository.c | 6 +- repository.h | 8 +- rerere.c | 8 +- resolve-undo.c | 4 +- revision.c | 7 +- run-command.c | 2 +- run-command.h | 4 +- send-pack.c | 2 +- sequencer.c | 7 +- serve.c | 1 + server-info.c | 3 +- setup.c | 497 +++++++++++++++++++++ setup.h | 9 + shallow.c | 6 +- sparse-index.c | 6 +- sparse-index.h | 2 + split-index.c | 3 +- statinfo.c | 87 ++++ statinfo.h | 51 +++ strbuf.c | 1 + strbuf.h | 4 - streaming.c | 2 +- submodule-config.c | 3 +- submodule.c | 6 +- t/helper/test-cache-tree.c | 2 +- t/helper/test-dump-cache-tree.c | 2 +- t/helper/test-dump-fsmonitor.c | 2 +- t/helper/test-dump-split-index.c | 3 +- t/helper/test-dump-untracked-cache.c | 2 +- t/helper/test-fast-rebase.c | 3 +- t/helper/test-fsmonitor-client.c | 2 +- t/helper/test-hash-speed.c | 2 +- t/helper/test-index-version.c | 2 +- t/helper/test-lazy-init-name-hash.c | 3 +- t/helper/test-pack-mtimes.c | 2 +- t/helper/test-partial-clone.c | 2 +- t/helper/test-path-utils.c | 2 +- t/helper/test-read-cache.c | 2 +- t/helper/test-read-graph.c | 2 +- t/helper/test-read-midx.c | 2 +- t/helper/test-ref-store.c | 4 +- t/helper/test-repository.c | 2 +- t/helper/test-revision-walking.c | 1 + t/helper/test-scrap-cache-tree.c | 2 +- t/helper/test-sha1.c | 2 +- t/helper/test-sha256.c | 2 +- t/helper/test-strcmp-offset.c | 2 +- t/helper/test-wildmatch.c | 1 + t/helper/test-write-cache.c | 2 +- t/t1301-shared-repo.sh | 22 + t/t5606-clone-options.sh | 10 + tag.c | 2 +- tmp-objdir.c | 3 +- trace2/tr2_cfg.c | 1 + transport-helper.c | 1 + transport.c | 2 +- tree-diff.c | 1 + tree-walk.c | 2 +- tree.c | 2 +- unpack-trees.c | 6 +- unpack-trees.h | 2 +- upload-pack.c | 2 +- walker.c | 3 +- worktree.c | 1 + wt-status.c | 5 +- xdiff-interface.c | 3 +- 312 files changed, 2179 insertions(+), 1895 deletions(-) create mode 100644 fsmonitor-ll.h rename ll-merge.c => merge-ll.c (99%) rename ll-merge.h => merge-ll.h (100%) create mode 100644 merge.h create mode 100644 name-hash.h create mode 100644 object-store-ll.h create mode 100644 preload-index.h rename cache.h => read-cache-ll.h (79%) create mode 100644 read-cache.h create mode 100644 statinfo.c
base-commit: ca06ff8883c0c6ae9135d64692f71b41c2493346
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1525%2Fnewren%2Fheader-cleanup-5-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1525/newren/header-cleanup-5-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1525
Range-diff vs v2:
1: f7ee69e7e68 ! 1: 5b39c530f2a init-db: document existing bug with core.bare in template config
@@ builtin/init-db.c: static int create_default_files(const char *template_path,
+ *
+ * To see why, note that before this function, there was this call:
+ * init_is_bare_repository = is_bare_repository()
-+ * expanding the right hande side:
++ * expanding the right hand side:
+ * = is_bare_repository_cfg && !get_git_work_tree()
+ * = is_bare_repository_cfg && !work_tree
+ * note that the last simplification above is valid because nothing
2: 5ba9d6e68ad ! 2: 93067838fb2 init-db: remove unnecessary global variable
@@ builtin/init-db.c: static int create_default_files(const char *template_path,
* To see why, note that before this function, there was this call:
- * init_is_bare_repository = is_bare_repository()
+ * prev_bare_repository = is_bare_repository()
- * expanding the right hande side:
+ * expanding the right hand side:
* = is_bare_repository_cfg && !get_git_work_tree()
* = is_bare_repository_cfg && !work_tree
@@ builtin/init-db.c: static int create_default_files(const char *template_path,
3: 3bc4dfeea90 ! 3: 28c8f4a29a8 init-db, clone: change unnecessary global into passed parameter
@@ Metadata
## Commit message ##
init-db, clone: change unnecessary global into passed parameter
- Much like the former commit, this commit was prompted by a desire to
+ Much like the parent commit, this commit was prompted by a desire to
move the functions which builtin/init-db.c and builtin/clone.c share out of the former file and into setup.c. A secondary issue that made it difficult was the init_shared_repository global variable; replace it
4: 60d01387f41 ! 4: fc1272c981e setup: adopt shared init-db & clone code
@@ builtin/init-db.c
- *
- * To see why, note that before this function, there was this call:
- * prev_bare_repository = is_bare_repository()
-- * expanding the right hande side:
+- * expanding the right hand side:
- * = is_bare_repository_cfg && !get_git_work_tree()
- * = is_bare_repository_cfg && !work_tree
- * note that the last simplification above is valid because nothing
@@ setup.c: int daemonize(void)
+ *
+ * To see why, note that before this function, there was this call:
+ * prev_bare_repository = is_bare_repository()
-+ * expanding the right hande side:
++ * expanding the right hand side:
+ * = is_bare_repository_cfg && !get_git_work_tree()
+ * = is_bare_repository_cfg && !work_tree
+ * note that the last simplification above is valid because nothing
5: ced75f46444 = 5: 1979b5dbfd7 read-cache: move shared commit and ls-files code
6: 13d6dd1095c = 6: 8f7d82ce1c8 add: modify add_files_to_cache() to avoid globals
7: 63058d44595 = 7: f95d5aebd4a read-cache: move shared add/checkout/commit code
8: 39e5f6ca470 = 8: fc6286718d4 statinfo: move stat_{data,validity} functions from cache/read-cache
9: f56714080b1 = 9: 706e02727fc run-command.h: move declarations for run-command.c from cache.h
10: 7d48dbfe0aa = 10: d8b396bd633 name-hash.h: move declarations for name-hash.c from cache.h
11: f46aa5e73a1 = 11: 18cdefc5667 sparse-index.h: move declarations for sparse-index.c from cache.h
12: b16c4d3429e = 12: 19226c30cdf preload-index.h: move declarations for preload-index.c from elsewhere
13: c8f873d71f5 = 13: 2be96fbbe56 diff.h: move declaration for global in diff.c from cache.h
14: 77c3c5918b8 = 14: 8a940282299 merge.h: move declarations for merge.c from cache.h
15: abfb127b812 = 15: c8d8032c75c repository.h: move declaration of the_index from cache.h
16: 41183b7baed = 16: 117706f63d2 read-cache*.h: move declarations for read-cache.c functions from cache.h
17: 8f021be54e0 = 17: a9ceb3a122a cache.h: remove this no-longer-used header
18: ea21839a95a = 18: beb4287dd65 log-tree: replace include of revision.h with simple forward declaration
19: bd70d3fe730 = 19: 3e8ae022927 repository: remove unnecessary include of path.h
20: a438cfbb095 = 20: 127f4fca309 diff.h: remove unnecessary include of oidset.h
21: b8f302184fa = 21: b9231a414f2 list-objects-filter-options.h: remove unneccessary include
22: 1d3d33a843b = 22: 452254dbce0 builtin.h: remove unneccessary includes
23: 7849fea5fa4 = 23: fe631d90b4f git-compat-util.h: remove unneccessary include of wildmatch.h
24: 97d04efde7b = 24: 35703377580 merge-ll: rename from ll-merge
25: e0bfeb98556 ! 25: 6de1eebfea6 khash: name the structs that khash declares
@@ khash.h: static inline khint_t __ac_X31_hash_string(const char *s)
khint_t n_buckets, size, n_occupied, upper_bound; \
khint32_t *flags; \
khkey_t *keys; \
+
+ ## object-store.h ##
+@@ object-store.h: struct raw_object_store {
+ */
+ struct object_directory *odb;
+ struct object_directory **odb_tail;
+- kh_odb_path_map_t *odb_by_path;
++ struct kh_odb_path_map *odb_by_path;
+
+ int loaded_alternates;
+
26: 41d48379b3d ! 26: 264d64011bd hash-ll, hashmap: move oidhash() to hash-ll
@@ Metadata
Author: Elijah Newren <[email protected]>
## Commit message ##
- hash-ll, hashmap: move oidhash() to hash-ll
+ object-store-ll.h: split this header out of object-store.h
- oidhash() was used by both hashmap and khash, which makes sense.
- However, the location of this function in hashmap.[ch] meant that
- khash.h had to depend upon hashmap.h, making people unfamiliar with
- khash think that it was built upon hashmap. (Or at least, I personally
- was confused for a while about this in the past.)
+ The vast majority of files including object-store.h did not need dir.h
+ nor khash.h. Split the header into two files, and let most just depend
+ upon object-store-ll.h, while letting the two callers that need it
+ depend on the full object-store.h.
- Move this function to hash-ll, so that khash.h can stop depending upon
- hashmap.h.
+ After this patch:
+ $ git grep -h include..object-store | sort | uniq -c
+ 2 #include "object-store.h"
+ 129 #include "object-store-ll.h"
- This has another benefit as well: it allows us to remove hashmap.h's
- dependency on hash-ll.h. While some callers of hashmap.h were making
- use of oidhash, most were not, so this change provides another way to
- reduce the number of includes.
-
- Diff best viewed with `--color-moved`. Note that there's a small but
- important change to khash.h in this patch as well to allow this move,
- which is easy to overlook.
+ Diff best viewed with `--color-moved`.
Signed-off-by: Elijah Newren <[email protected]>
@@ convert.c
#include "run-command.h"
#include "quote.h"
- ## decorate.c ##
-@@
- * data.
- */
- #include "git-compat-util.h"
--#include "hashmap.h"
- #include "object.h"
- #include "decorate.h"
-
-
## diagnose.c ##
@@
#include "gettext.h"
@@ dir.c
#include "attr.h"
#include "refs.h"
- ## dir.h ##
-@@
- #ifndef DIR_H
- #define DIR_H
-
-+#include "hash-ll.h"
- #include "hashmap.h"
- #include "pathspec.h"
- #include "statinfo.h"
-
## entry.c ##
@@
#include "git-compat-util.h"
@@ grep.c
#include "userdiff.h"
#include "xdiff-interface.h"
- ## hash-ll.h ##
-@@ hash-ll.h: static inline void oid_set_algo(struct object_id *oid, const struct git_hash_alg
- oid->algo = hash_algo_by_ptr(algop);
- }
-
-+/*
-+ * Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code
-+ * for use in hash tables. Cryptographic hashes are supposed to have
-+ * uniform distribution, so in contrast to `memhash()`, this just copies
-+ * the first `sizeof(int)` bytes without shuffling any bits. Note that
-+ * the results will be different on big-endian and little-endian
-+ * platforms, so they should not be stored or transferred over the net.
-+ */
-+static inline unsigned int oidhash(const struct object_id *oid)
-+{
-+ /*
-+ * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on
-+ * platforms that don't support unaligned reads.
-+ */
-+ unsigned int hash;
-+ memcpy(&hash, oid->hash, sizeof(hash));
-+ return hash;
-+}
-+
- const char *empty_tree_oid_hex(void);
- const char *empty_blob_oid_hex(void);
-
-
- ## hashmap.h ##
-@@
- #ifndef HASHMAP_H
- #define HASHMAP_H
-
--#include "hash-ll.h"
--
- /*
- * Generic implementation of hash-based key-value mappings.
- *
-@@ hashmap.h: unsigned int memhash(const void *buf, size_t len);
- unsigned int memihash(const void *buf, size_t len);
- unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len);
-
--/*
-- * Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code
-- * for use in hash tables. Cryptographic hashes are supposed to have
-- * uniform distribution, so in contrast to `memhash()`, this just copies
-- * the first `sizeof(int)` bytes without shuffling any bits. Note that
-- * the results will be different on big-endian and little-endian
-- * platforms, so they should not be stored or transferred over the net.
-- */
--static inline unsigned int oidhash(const struct object_id *oid)
--{
-- /*
-- * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on
-- * platforms that don't support unaligned reads.
-- */
-- unsigned int hash;
-- memcpy(&hash, oid->hash, sizeof(hash));
-- return hash;
--}
--
- /*
- * struct hashmap_entry is an opaque structure representing an entry in the
- * hash table.
-
## http-backend.c ##
@@
#include "url.h"
@@ http.c
static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
static int trace_curl_data = 1;
- ## khash.h ##
-@@
- #ifndef __AC_KHASH_H
- #define __AC_KHASH_H
-
--#include "hashmap.h"
- #include "hash.h"
-
- #define AC_VERSION_KHASH_H "0.2.8"
-
## list-objects-filter.c ##
@@
#include "oidmap.h"
@@ object-store.h
- */
- struct object_directory *odb;
- struct object_directory **odb_tail;
-- kh_odb_path_map_t *odb_by_path;
+- struct kh_odb_path_map *odb_by_path;
-
- int loaded_alternates;
-
@@ remote.c
#include "commit.h"
#include "diff.h"
- ## remote.h ##
-@@
- #ifndef REMOTE_H
- #define REMOTE_H
-
-+#include "hash-ll.h"
- #include "hashmap.h"
- #include "refspec.h"
-
-
## replace-object.c ##
@@
#include "gettext.h"
@@ sequencer.c
#include "pager.h"
#include "commit.h"
- ## serve.c ##
-@@
- #include "git-compat-util.h"
- #include "repository.h"
- #include "config.h"
-+#include "hash-ll.h"
- #include "pkt-line.h"
- #include "version.h"
- #include "ls-refs.h"
-
## server-info.c ##
@@
#include "packfile.h"
-: ----------- > 27: d6057718fde hash-ll, hashmap: move oidhash() to hash-ll
27: bbe64fccd52 = 28: 7b853c9e440 fsmonitor-ll.h: split this header out of fsmonitor.hSignature · 1 line
gitgitgadget
PATCH v3 1/28 init-db: document existing bug with core.bare in template config
From: Elijah Newren <[email protected]>
The comments in create_default_files() talks about reading config from the config file in the specified --templates directory, which leads to the question of whether core.bare could be set in such a config file and thus whether the code is doing the right thing. It turns out, that it doesn't; it unconditionally ignores core.bare in the config file in any --templates directory. It is not clear to me that fixing it can be done within this function; it seems to occur too late:
* create_default_files() is called by init_db()
* init_db() is called by both builtin/{clone.c,init-db.c}
* both callers of init_db() call set_git_work_tree() before init_db()
and in order to actual affect whether a repository is bear, we'd need to somewhere reset these values, not just the is_bare_repository_cfg setting.
I do not want to open this can of worms at this time; I'm trying to clean up some headers, for which I need to move some functions, for which I need to clean up some globals, and that's far enough down the rabbit hole. So, simply document the issue with a careful TODO comment and a few testcases.
--- builtin/init-db.c | 29 ++++++++++++++++++++++++++++- t/t1301-shared-repo.sh | 22 ++++++++++++++++++++++ t/t5606-clone-options.sh | 10 ++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-)
builtin/init-db.c +28 -1
@@ -231,9 +231,36 @@ static int create_default_files(const char *template_path,* We must make sure command-line options continue to override any * values we might have just re-read from the config. */ - is_bare_repository_cfg = init_is_bare_repository || !work_tree;if (init_shared_repository !=-1 )set_shared_repository (init_shared_repository); +/* +* TODO: heed core.bare from config file in templates if no +* command-line override given +*/ + is_bare_repository_cfg = init_is_bare_repository || !work_tree; +/* TODO (continued): +* +* Unfortunately, the line above is equivalent to +* is_bare_repository_cfg = !work_tree; +* which ignores the config entirely even if no `--[no-]bare` +* command line option was present. +* +* To see why, note that before this function, there was this call: +* init_is_bare_repository = is_bare_repository() +* expanding the right hand side: +* = is_bare_repository_cfg && !get_git_work_tree() +* = is_bare_repository_cfg && !work_tree +* note that the last simplification above is valid because nothing +* calls repo_init() or set_git_work_tree() between any of the +* relevant calls in the code, and thus the !get_git_work_tree() +* calls will return the same result each time. So, what we are +* interested in computing is the right hand side of the line of +* code just above this comment: +* init_is_bare_repository || !work_tree +* = is_bare_repository_cfg && !work_tree || !work_tree +* = !work_tree +* because "A && !B || !B == !B" for all boolean values of A & B. +*/ /* * We would have created the above under user's umask -- under
t/t1301-shared-repo.sh +22 -0
@@ -52,6 +52,28 @@ test_expect_success 'shared=all' ' test 2 = $(git config core.sharedrepository) ' +test_expect_failure 'template can set core.bare' ' + test_when_finished "rm -rf subdir" && + test_when_finished "rm -rf templates" && + test_config core.bare true && + umask 0022 && + mkdir -p templates/ && + cp .git/config templates/config && + git init --template=templates subdir && + test_path_exists subdir/HEAD +' + +test_expect_success 'template can set core.bare but overridden by command line' ' + test_when_finished "rm -rf subdir" && + test_when_finished "rm -rf templates" && + test_config core.bare true && + umask 0022 && + mkdir -p templates/ && + cp .git/config templates/config && + git init --no-bare --template=templates subdir && + test_path_exists subdir/.git/HEAD +' + test_expect_success POSIXPERM 'update-server-info honors core.sharedRepository' ' : > a1 && git add a1 &&
t/t5606-clone-options.sh +10 -0
@@ -120,6 +120,16 @@ test_expect_success 'prefers -c config over --template config' ' ' +test_expect_failure 'prefers --template config even for core.bare' ' + + template="$TRASH_DIRECTORY/template-with-bare-config" && + mkdir "$template" && + git config --file "$template/config" core.bare true && + git clone "--template=$template" parent clone-bare-config && + test "$(git -C clone-bare-config config --local core.bare)" = "true" && + test_path_is_file clone-bare-config/HEAD +' + test_expect_success 'prefers config "clone.defaultRemoteName" over default' ' test_config_global clone.defaultRemoteName from_config &&
Signature · 1 line
gitgitgadget
PATCH v3 2/28 init-db: remove unnecessary global variable
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
This commit was prompted by a desire to move the functions which builtin/init-db.c and builtin/clone.c share out of the former file and into setup.c. One issue that made it difficult was the init_is_bare_repository global variable.
init_is_bare_repository's sole use in life it to cache a value in init_db(), and then be used in create_default_files(). This is a bit odd since init_db() directly calls create_default_files(), and is the only caller of that function. Convert the global to a simple function parameter instead.
(Of course, this doesn't fix the fact that this value is then ignored by create_default_files(), as noted in a big TODO comment in that function, but it at least includes no behavioral change other than getting rid of a very questionable global variable.)
--- builtin/init-db.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
builtin/init-db.c +7 -5
@@ -31,7 +31,6 @@#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH" -static int init_is_bare_repository =0 ;static int init_shared_repository =-1 ; static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
@@ -199,6 +198,7 @@ static int create_default_files(const char *template_path,const char *original_git_dir, const char *initial_branch, const struct repository_format *fmt, + int prev_bare_repository, int quiet) { struct stat st1;
@@ -237,7 +237,7 @@ static int create_default_files(const char *template_path,* TODO: heed core.bare from config file in templates if no * command-line override given */ - is_bare_repository_cfg = init_is_bare_repository || !work_tree; + is_bare_repository_cfg = prev_bare_repository || !work_tree;/* TODO (continued): * * Unfortunately, the line above is equivalent to
@@ -246,7 +246,7 @@ static int create_default_files(const char *template_path,* command line option was present. * * To see why, note that before this function, there was this call: -* init_is_bare_repository = is_bare_repository() +* prev_bare_repository = is_bare_repository() * expanding the right hand side: * = is_bare_repository_cfg && !get_git_work_tree() * = is_bare_repository_cfg && !work_tree
@@ -256,7 +256,7 @@ static int create_default_files(const char *template_path,* calls will return the same result each time. So, what we are * interested in computing is the right hand side of the line of * code just above this comment: -* init_is_bare_repository || !work_tree +* prev_bare_repository || !work_tree * = is_bare_repository_cfg && !work_tree || !work_tree * = !work_tree * because "A && !B || !B == !B" for all boolean values of A & B.
@@ -424,6 +424,7 @@ int init_db(const char *git_dir, const char *real_git_dir,int exist_ok = flags &INIT_DB_EXIST_OK ;char *original_git_dir =real_pathdup (git_dir,1 );struct repository_format repo_fmt =REPOSITORY_FORMAT_INIT ; +int prev_bare_repository;if (real_git_dir) {struct stat st;
@@ -449,7 +450,7 @@ int init_db(const char *git_dir, const char *real_git_dir,safe_create_dir (git_dir,0 ); - init_is_bare_repository =is_bare_repository (); + prev_bare_repository =is_bare_repository ();/* Check to see if the repository version is right. * Note that a newly created repository does not have
@@ -462,6 +463,7 @@ int init_db(const char *git_dir, const char *real_git_dir, reinit =create_default_files (template_dir, original_git_dir, initial_branch, &repo_fmt, + prev_bare_repository, flags &INIT_DB_QUIET );if (reinit && initial_branch) warning(_("re-init: ignored --initial-branch=%s"),
Signature · 1 line
gitgitgadget
PATCH v3 3/28 init-db, clone: change unnecessary global into passed parameter
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
Much like the parent commit, this commit was prompted by a desire to move the functions which builtin/init-db.c and builtin/clone.c share out of the former file and into setup.c. A secondary issue that made it difficult was the init_shared_repository global variable; replace it with a simple parameter that is passed to the relevant functions.
--- builtin/clone.c | 3 ++- builtin/init-db.c | 9 +++++---- cache.h | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-)
builtin/clone.c +2 -1
@@ -930,6 +930,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)int submodule_progress;int filter_submodules =0 ;int hash_algo; +const int do_not_override_repo_unix_permissions =-1 ;struct transport_ls_refs_options transport_ls_refs_options =TRANSPORT_LS_REFS_OPTIONS_INIT ;
@@ -1097,7 +1098,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) }init_db (git_dir, real_git_dir, option_template,GIT_HASH_UNKNOWN ,NULL , -INIT_DB_QUIET ); + do_not_override_repo_unix_permissions,INIT_DB_QUIET );if (real_git_dir) {free ((char *)git_dir);
builtin/init-db.c +5 -4
@@ -31,8 +31,6 @@#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH" -static int init_shared_repository =-1 ; -static void copy_templates_1 (struct strbuf *path,struct strbuf *template_path,DIR *dir) {
@@ -199,6 +197,7 @@ static int create_default_files(const char *template_path,const char *initial_branch, const struct repository_format *fmt, int prev_bare_repository, + int init_shared_repository, int quiet) { struct stat st1;
@@ -418,7 +417,7 @@ static void validate_hash_algorithm(struct repository_format *repo_fmt, int hashint init_db (const char *git_dir,const char *real_git_dir,const char *template_dir,int hash,const char *initial_branch, -unsigned int flags) +int init_shared_repository,unsigned int flags) {int reinit;int exist_ok = flags &INIT_DB_EXIST_OK ;
@@ -464,6 +463,7 @@ int init_db(const char *git_dir, const char *real_git_dir, reinit =create_default_files (template_dir, original_git_dir, initial_branch, &repo_fmt, prev_bare_repository, + init_shared_repository, flags &INIT_DB_QUIET );if (reinit && initial_branch) warning(_("re-init: ignored --initial-branch=%s"),
@@ -575,6 +575,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)const char *object_format =NULL ;const char *initial_branch =NULL ;int hash_algo =GIT_HASH_UNKNOWN ; +int init_shared_repository =-1 ;const struct option init_db_options[] = {OPT_STRING (0 ,"template" , &template_dir,N_ ("template-directory" ),N_ ("directory from which templates will be used" )),
@@ -732,5 +733,5 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) flags |=INIT_DB_EXIST_OK ;return init_db (git_dir, real_git_dir, template_dir, hash_algo, - initial_branch, flags); + initial_branch, init_shared_repository, flags); }
cache.h +2 -1
@@ -327,7 +327,8 @@ extern struct index_state the_index;int init_db (const char *git_dir,const char *real_git_dir,const char *template_dir,int hash_algo, -const char *initial_branch,unsigned int flags); +const char *initial_branch,int init_shared_repository, +unsigned int flags);void initialize_repository_version (int hash_algo,int reinit);/* Initialize and use the cache information */
Signature · 1 line
gitgitgadget
PATCH v3 4/28 setup: adopt shared init-db & clone code
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The functions init_db() and initialize_repository_version() were shared by builtin/init-db.c and builtin/clone.c, and declared in cache.h.
Move these functions, plus their several helpers only used by these functions, to setup.[ch].
Diff best viewed with --color-moved.
--- builtin/init-db.c | 496 ---------------------------------------------- cache.h | 9 - setup.c | 496 ++++++++++++++++++++++++++++++++++++++++++++++ setup.h | 9 + 4 files changed, 505 insertions(+), 505 deletions(-)
builtin/init-db.c +0 -496
@@ -6,511 +6,15 @@#include "cache.h" #include "abspath.h" #include "config.h" -#include "copy.h" #include "environment.h" #include "gettext.h" -#include "refs.h" #include "builtin.h" -#include "exec-cmd.h" #include "object-file.h" #include "parse-options.h" #include "path.h" #include "setup.h" -#include "worktree.h" #include "wrapper.h" -#ifndef DEFAULT_GIT_TEMPLATE_DIR -#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates" -#endif - -#ifdef NO_TRUSTABLE_FILEMODE -#define TEST_FILEMODE 0 -#else -#define TEST_FILEMODE 1 -#endif - -#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH" - -static void copy_templates_1 (struct strbuf *path,struct strbuf *template_path, -DIR *dir) -{ -size_t path_baselen = path->len; -size_t template_baselen = template_path->len; -struct dirent *de; - -/* Note: if ".git/hooks" file exists in the repository being -* re-initialized, /etc/core-git/templates/hooks/update would -* cause "git init" to fail here. I think this is sane but -* it means that the set of templates we ship by default, along -* with the way the namespace under .git/ is organized, should -* be really carefully chosen. -*/ -safe_create_dir (path->buf,1 ); -while ((de =readdir (dir)) !=NULL ) { -struct stat st_git, st_template; -int exists =0 ; - -strbuf_setlen (path, path_baselen); -strbuf_setlen (template_path, template_baselen); - -if (de->d_name[0 ] =='.' ) -continue ; -strbuf_addstr (path, de->d_name); -strbuf_addstr (template_path, de->d_name); -if (lstat (path->buf, &st_git)) { -if (errno !=ENOENT ) -die_errno (_ ("cannot stat '%s'" ), path->buf); - } -else - exists =1 ; - -if (lstat (template_path->buf, &st_template)) -die_errno (_ ("cannot stat template '%s'" ), template_path->buf); - -if (S_ISDIR (st_template.st_mode)) { -DIR *subdir =opendir (template_path->buf); -if (!subdir) -die_errno (_ ("cannot opendir '%s'" ), template_path->buf); -strbuf_addch (path,'/' ); -strbuf_addch (template_path,'/' ); -copy_templates_1 (path, template_path, subdir); -closedir (subdir); - } -else if (exists) -continue ; -else if (S_ISLNK (st_template.st_mode)) { -struct strbuf lnk =STRBUF_INIT ; -if (strbuf_readlink (&lnk, template_path->buf, - st_template.st_size) <0 ) -die_errno (_ ("cannot readlink '%s'" ), template_path->buf); -if (symlink (lnk.buf, path->buf)) -die_errno (_ ("cannot symlink '%s' '%s'" ), - lnk.buf, path->buf); -strbuf_release (&lnk); - } -else if (S_ISREG (st_template.st_mode)) { -if (copy_file (path->buf, template_path->buf, st_template.st_mode)) -die_errno (_ ("cannot copy '%s' to '%s'" ), - template_path->buf, path->buf); - } -else -error (_ ("ignoring template %s" ), template_path->buf); - } -} - -static void copy_templates (const char *template_dir,const char *init_template_dir) -{ -struct strbuf path =STRBUF_INIT ; -struct strbuf template_path =STRBUF_INIT ; -size_t template_len; -struct repository_format template_format =REPOSITORY_FORMAT_INIT ; -struct strbuf err =STRBUF_INIT ; -DIR *dir; -char *to_free =NULL ; - -if (!template_dir) - template_dir =getenv (TEMPLATE_DIR_ENVIRONMENT ); -if (!template_dir) - template_dir = init_template_dir; -if (!template_dir) - template_dir = to_free =system_path (DEFAULT_GIT_TEMPLATE_DIR ); -if (!template_dir[0 ]) { -free (to_free); -return ; - } - -strbuf_addstr (&template_path, template_dir); -strbuf_complete (&template_path,'/' ); - template_len = template_path.len; - - dir =opendir (template_path.buf); -if (!dir) { -warning (_ ("templates not found in %s" ), template_dir); - goto free_return; - } - -/* Make sure that template is from the correct vintage */ -strbuf_addstr (&template_path,"config" ); -read_repository_format (&template_format, template_path.buf); -strbuf_setlen (&template_path, template_len); - -/* -* No mention of version at all is OK, but anything else should be -* verified. -*/ -if (template_format.version >=0 && -verify_repository_format (&template_format, &err) <0 ) { -warning (_ ("not copying templates from '%s': %s" ), - template_dir, err.buf); -strbuf_release (&err); - goto close_free_return; - } - -strbuf_addstr (&path,get_git_common_dir ()); -strbuf_complete (&path,'/' ); -copy_templates_1 (&path, &template_path, dir); -close_free_return: -closedir (dir); -free_return: -free (to_free); -strbuf_release (&path); -strbuf_release (&template_path); -clear_repository_format (&template_format); -} - -/* -* If the git_dir is not directly inside the working tree, then git will not -* find it by default, and we need to set the worktree explicitly. -*/ -static int needs_work_tree_config (const char *git_dir,const char *work_tree) -{ -if (!strcmp (work_tree,"/" ) && !strcmp (git_dir,"/.git" )) -return 0 ; -if (skip_prefix (git_dir, work_tree, &git_dir) && - !strcmp (git_dir,"/.git" )) -return 0 ; -return 1 ; -} - -void initialize_repository_version (int hash_algo,int reinit) -{ -char repo_version_string[10 ]; -int repo_version =GIT_REPO_VERSION ; - -if (hash_algo !=GIT_HASH_SHA1 ) - repo_version =GIT_REPO_VERSION_READ ; - -/* This forces creation of new config file */ -xsnprintf (repo_version_string,sizeof (repo_version_string), -"%d" , repo_version); -git_config_set ("core.repositoryformatversion" , repo_version_string); - -if (hash_algo !=GIT_HASH_SHA1 ) -git_config_set ("extensions.objectformat" , - hash_algos[hash_algo].name); -else if (reinit) -git_config_set_gently ("extensions.objectformat" ,NULL ); -} - -static int create_default_files (const char *template_path, -const char *original_git_dir, -const char *initial_branch, -const struct repository_format *fmt, -int prev_bare_repository, -int init_shared_repository, -int quiet) -{ -struct stat st1; -struct strbuf buf =STRBUF_INIT ; -char *path; -char junk[2 ]; -int reinit; -int filemode; -struct strbuf err =STRBUF_INIT ; -const char *init_template_dir =NULL ; -const char *work_tree =get_git_work_tree (); - -/* -* First copy the templates -- we might have the default -* config file there, in which case we would want to read -* from it after installing. -* -* Before reading that config, we also need to clear out any cached -* values (since we've just potentially changed what's available on -* disk). -*/ -git_config_get_pathname ("init.templatedir" , &init_template_dir); -copy_templates (template_path, init_template_dir); -free ((char *)init_template_dir); -git_config_clear (); -reset_shared_repository (); -git_config (git_default_config,NULL ); - -/* -* We must make sure command-line options continue to override any -* values we might have just re-read from the config. -*/ -if (init_shared_repository !=-1 ) -set_shared_repository (init_shared_repository); -/* -* TODO: heed core.bare from config file in templates if no -* command-line override given -*/ - is_bare_repository_cfg = prev_bare_repository || !work_tree; -/* TODO (continued): -* -* Unfortunately, the line above is equivalent to -* is_bare_repository_cfg = !work_tree; -* which ignores the config entirely even if no `--[no-]bare` -* command line option was present. -* -* To see why, note that before this function, there was this call: -* prev_bare_repository = is_bare_repository() -* expanding the right hand side: -* = is_bare_repository_cfg && !get_git_work_tree() -* = is_bare_repository_cfg && !work_tree -* note that the last simplification above is valid because nothing -* calls repo_init() or set_git_work_tree() between any of the -* relevant calls in the code, and thus the !get_git_work_tree() -* calls will return the same result each time. So, what we are -* interested in computing is the right hand side of the line of -* code just above this comment: -* prev_bare_repository || !work_tree -* = is_bare_repository_cfg && !work_tree || !work_tree -* = !work_tree -* because "A && !B || !B == !B" for all boolean values of A & B. -*/ - -/* -* We would have created the above under user's umask -- under -* shared-repository settings, we would need to fix them up. -*/ -if (get_shared_repository ()) { -adjust_shared_perm (get_git_dir ()); - } - -/* -* We need to create a "refs" dir in any case so that older -* versions of git can tell that this is a repository. -*/ -safe_create_dir (git_path ("refs" ),1 ); -adjust_shared_perm (git_path ("refs" )); - -if (refs_init_db (&err)) -die ("failed to set up refs db: %s" , err.buf); - -/* -* Point the HEAD symref to the initial branch with if HEAD does -* not yet exist. -*/ - path =git_path_buf (&buf,"HEAD" ); - reinit = (!access (path,R_OK ) - ||readlink (path, junk,sizeof (junk)-1 ) !=-1 ); -if (!reinit) { -char *ref; - -if (!initial_branch) - initial_branch =git_default_branch_name (quiet); - - ref =xstrfmt ("refs/heads/%s" , initial_branch); -if (check_refname_format (ref,0 ) <0 ) -die (_ ("invalid initial branch name: '%s'" ), - initial_branch); - -if (create_symref ("HEAD" , ref,NULL ) <0 ) -exit (1 ); -free (ref); - } - -initialize_repository_version (fmt->hash_algo,0 ); - -/* Check filemode trustability */ - path =git_path_buf (&buf,"config" ); - filemode =TEST_FILEMODE ; -if (TEST_FILEMODE && !lstat (path, &st1)) { -struct stat st2; - filemode = (!chmod (path, st1.st_mode ^S_IXUSR ) && - !lstat (path, &st2) && - st1.st_mode != st2.st_mode && - !chmod (path, st1.st_mode)); -if (filemode && !reinit && (st1.st_mode &S_IXUSR )) - filemode =0 ; - } -git_config_set ("core.filemode" , filemode ?"true" :"false" ); - -if (is_bare_repository ()) -git_config_set ("core.bare" ,"true" ); -else { -git_config_set ("core.bare" ,"false" ); -/* allow template config file to override the default */ -if (log_all_ref_updates ==LOG_REFS_UNSET ) -git_config_set ("core.logallrefupdates" ,"true" ); -if (needs_work_tree_config (original_git_dir, work_tree)) -git_config_set ("core.worktree" , work_tree); - } - -if (!reinit) { -/* Check if symlink is supported in the work tree */ - path =git_path_buf (&buf,"tXXXXXX" ); -if (!close (xmkstemp (path)) && - !unlink (path) && - !symlink ("testing" , path) && - !lstat (path, &st1) && -S_ISLNK (st1.st_mode)) -unlink (path);/* good */ -else -git_config_set ("core.symlinks" ,"false" ); - -/* Check if the filesystem is case-insensitive */ - path =git_path_buf (&buf,"CoNfIg" ); -if (!access (path,F_OK )) -git_config_set ("core.ignorecase" ,"true" ); -probe_utf8_pathname_composition (); - } - -strbuf_release (&buf); -return reinit; -} - -static void create_object_directory (void ) -{ -struct strbuf path =STRBUF_INIT ; -size_t baselen; - -strbuf_addstr (&path,get_object_directory ()); - baselen = path.len; - -safe_create_dir (path.buf,1 ); - -strbuf_setlen (&path, baselen); -strbuf_addstr (&path,"/pack" ); -safe_create_dir (path.buf,1 ); - -strbuf_setlen (&path, baselen); -strbuf_addstr (&path,"/info" ); -safe_create_dir (path.buf,1 ); - -strbuf_release (&path); -} - -static void separate_git_dir (const char *git_dir,const char *git_link) -{ -struct stat st; - -if (!stat (git_link, &st)) { -const char *src; - -if (S_ISREG (st.st_mode)) - src =read_gitfile (git_link); -else if (S_ISDIR (st.st_mode)) - src = git_link; -else -die (_ ("unable to handle file type %d" ), (int )st.st_mode); - -if (rename (src, git_dir)) -die_errno (_ ("unable to move %s to %s" ), src, git_dir); -repair_worktrees (NULL ,NULL ); - } - -write_file (git_link,"gitdir: %s" , git_dir); -} - -static void validate_hash_algorithm (struct repository_format *repo_fmt,int hash) -{ -const char *env =getenv (GIT_DEFAULT_HASH_ENVIRONMENT ); -/* -* If we already have an initialized repo, don't allow the user to -* specify a different algorithm, as that could cause corruption. -* Otherwise, if the user has specified one on the command line, use it. -*/ -if (repo_fmt->version >=0 && hash !=GIT_HASH_UNKNOWN && hash != repo_fmt->hash_algo) -die (_ ("attempt to reinitialize repository with different hash" )); -else if (hash !=GIT_HASH_UNKNOWN ) - repo_fmt->hash_algo = hash; -else if (env) { -int env_algo =hash_algo_by_name (env); -if (env_algo ==GIT_HASH_UNKNOWN ) -die (_ ("unknown hash algorithm '%s'" ), env); - repo_fmt->hash_algo = env_algo; - } -} - -int init_db (const char *git_dir,const char *real_git_dir, -const char *template_dir,int hash,const char *initial_branch, -int init_shared_repository,unsigned int flags) -{ -int reinit; -int exist_ok = flags &INIT_DB_EXIST_OK ; -char *original_git_dir =real_pathdup (git_dir,1 ); -struct repository_format repo_fmt =REPOSITORY_FORMAT_INIT ; -int prev_bare_repository; - -if (real_git_dir) { -struct stat st; - -if (!exist_ok && !stat (git_dir, &st)) -die (_ ("%s already exists" ), git_dir); - -if (!exist_ok && !stat (real_git_dir, &st)) -die (_ ("%s already exists" ), real_git_dir); - -set_git_dir (real_git_dir,1 ); - git_dir =get_git_dir (); -separate_git_dir (git_dir, original_git_dir); - } -else { -set_git_dir (git_dir,1 ); - git_dir =get_git_dir (); - } - startup_info->have_repository =1 ; - -/* Ensure `core.hidedotfiles` is processed */ -git_config (platform_core_config,NULL ); - -safe_create_dir (git_dir,0 ); - - prev_bare_repository =is_bare_repository (); - -/* Check to see if the repository version is right. -* Note that a newly created repository does not have -* config file, so this will not fail. What we are catching -* is an attempt to reinitialize new repository with an old tool. -*/ -check_repository_format (&repo_fmt); - -validate_hash_algorithm (&repo_fmt, hash); - - reinit =create_default_files (template_dir, original_git_dir, - initial_branch, &repo_fmt, - prev_bare_repository, - init_shared_repository, - flags &INIT_DB_QUIET ); -if (reinit && initial_branch) -warning (_ ("re-init: ignored --initial-branch=%s" ), - initial_branch); - -create_object_directory (); - -if (get_shared_repository ()) { -char buf[10 ]; -/* We do not spell "group" and such, so that -* the configuration can be read by older version -* of git. Note, we use octal numbers for new share modes, -* and compatibility values for PERM_GROUP and -* PERM_EVERYBODY. -*/ -if (get_shared_repository () <0 ) -/* force to the mode value */ -xsnprintf (buf,sizeof (buf),"0%o" , -get_shared_repository ()); -else if (get_shared_repository () ==PERM_GROUP ) -xsnprintf (buf,sizeof (buf),"%d" ,OLD_PERM_GROUP ); -else if (get_shared_repository () ==PERM_EVERYBODY ) -xsnprintf (buf,sizeof (buf),"%d" ,OLD_PERM_EVERYBODY ); -else -BUG ("invalid value for shared_repository" ); -git_config_set ("core.sharedrepository" , buf); -git_config_set ("receive.denyNonFastforwards" ,"true" ); - } - -if (!(flags &INIT_DB_QUIET )) { -int len =strlen (git_dir); - -if (reinit) -printf (get_shared_repository () - ?_ ("Reinitialized existing shared Git repository in %s%s\n" ) - :_ ("Reinitialized existing Git repository in %s%s\n" ), - git_dir, len && git_dir[len-1 ] !='/' ?"/" :"" ); -else -printf (get_shared_repository () - ?_ ("Initialized empty shared Git repository in %s%s\n" ) - :_ ("Initialized empty Git repository in %s%s\n" ), - git_dir, len && git_dir[len-1 ] !='/' ?"/" :"" ); - } - -free (original_git_dir); -return 0 ; -} -static int guess_repository_type (const char *git_dir) {const char *slash;
cache.h +0 -9
@@ -322,15 +322,6 @@ void prefetch_cache_entries(const struct index_state *istate,extern struct index_state the_index;#endif -#define INIT_DB_QUIET 0x0001 -#define INIT_DB_EXIST_OK 0x0002 - -int init_db (const char *git_dir,const char *real_git_dir, -const char *template_dir,int hash_algo, -const char *initial_branch,int init_shared_repository, -unsigned int flags); -void initialize_repository_version (int hash_algo,int reinit); -/* Initialize and use the cache information */ struct lock_file ; void preload_index(struct index_state *index,
setup.c +496 -0
513 lines not on this page · raw message
setup.h +9 -0
@@ -140,6 +140,15 @@ int verify_repository_format(const struct repository_format *format,*/ void check_repository_format (struct repository_format *fmt); +#define INIT_DB_QUIET 0x0001 +#define INIT_DB_EXIST_OK 0x0002 + +int init_db (const char *git_dir,const char *real_git_dir, +const char *template_dir,int hash_algo, +const char *initial_branch,int init_shared_repository, +unsigned int flags); +void initialize_repository_version (int hash_algo,int reinit); +/* * NOTE NOTE NOTE!! *
Signature · 1 line
gitgitgadget
PATCH v3 5/28 read-cache: move shared commit and ls-files code
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The function overlay_tree_on_index(), plus associated helper functions, were defined in builtin/ls-files.c, but also shared with builtin/commit.c. Move these shared functions to read-cache.c.
Diff best viewed with --color-moved.
--- builtin/ls-files.c | 137 --------------------------------------------- read-cache.c | 137 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 137 deletions(-)
builtin/ls-files.c +0 -137
@@ -516,143 +516,6 @@ static int get_common_prefix_len(const char *common_prefix)return common_prefix_len; } -static int read_one_entry_opt (struct index_state *istate, -const struct object_id *oid, -struct strbuf *base, -const char *pathname, -unsigned mode,int opt) -{ -int len; -struct cache_entry *ce; - -if (S_ISDIR (mode)) -return READ_TREE_RECURSIVE ; - - len =strlen (pathname); - ce =make_empty_cache_entry (istate, base->len + len); - - ce->ce_mode =create_ce_mode (mode); - ce->ce_flags =create_ce_flags (1 ); - ce->ce_namelen = base->len + len; -memcpy (ce->name, base->buf, base->len); -memcpy (ce->name + base->len, pathname, len+1 ); -oidcpy (&ce->oid, oid); -return add_index_entry (istate, ce, opt); -} - -static int read_one_entry (const struct object_id *oid,struct strbuf *base, -const char *pathname,unsigned mode, -void *context) -{ -struct index_state *istate = context; -return read_one_entry_opt (istate, oid, base, pathname, - mode, -ADD_CACHE_OK_TO_ADD |ADD_CACHE_SKIP_DFCHECK ); -} - -/* -* This is used when the caller knows there is no existing entries at -* the stage that will conflict with the entry being added. -*/ -static int read_one_entry_quick (const struct object_id *oid,struct strbuf *base, -const char *pathname,unsigned mode, -void *context) -{ -struct index_state *istate = context; -return read_one_entry_opt (istate, oid, base, pathname, - mode,ADD_CACHE_JUST_APPEND ); -} - -/* -* Read the tree specified with --with-tree option -* (typically, HEAD) into stage #1 and then -* squash them down to stage #0. This is used for -* --error-unmatch to list and check the path patterns -* that were given from the command line. We are not -* going to write this index out. -*/ -void overlay_tree_on_index (struct index_state *istate, -const char *tree_name,const char *prefix) -{ -struct tree *tree; -struct object_id oid; -struct pathspec pathspec; -struct cache_entry *last_stage0 =NULL ; -int i; -read_tree_fn_t fn =NULL ; -int err; - -if (repo_get_oid (the_repository, tree_name, &oid)) -die ("tree-ish %s not found." , tree_name); - tree =parse_tree_indirect (&oid); -if (!tree) -die ("bad tree-ish %s" , tree_name); - -/* Hoist the unmerged entries up to stage #3 to make room */ -/* TODO: audit for interaction with sparse-index. */ -ensure_full_index (istate); -for (i =0 ; i < istate->cache_nr; i++) { -struct cache_entry *ce = istate->cache[i]; -if (!ce_stage (ce)) -continue ; - ce->ce_flags |=CE_STAGEMASK ; - } - -if (prefix) { -static const char *(matchbuf[1 ]); - matchbuf[0 ] =NULL ; -parse_pathspec (&pathspec,PATHSPEC_ALL_MAGIC , -PATHSPEC_PREFER_CWD , prefix, matchbuf); - }else -memset (&pathspec,0 ,sizeof (pathspec)); - -/* -* See if we have cache entry at the stage. If so, -* do it the original slow way, otherwise, append and then -* sort at the end. -*/ -for (i =0 ; !fn && i < istate->cache_nr; i++) { -const struct cache_entry *ce = istate->cache[i]; -if (ce_stage (ce) ==1 ) - fn = read_one_entry; - } - -if (!fn) - fn = read_one_entry_quick; - err =read_tree (the_repository, tree, &pathspec, fn, istate); -clear_pathspec (&pathspec); -if (err) -die ("unable to read tree entries %s" , tree_name); - -/* -* Sort the cache entry -- we need to nuke the cache tree, though. -*/ -if (fn == read_one_entry_quick) { -cache_tree_free (&istate->cache_tree); -QSORT (istate->cache, istate->cache_nr, cmp_cache_name_compare); - } - -for (i =0 ; i < istate->cache_nr; i++) { -struct cache_entry *ce = istate->cache[i]; -switch (ce_stage (ce)) { -case 0 : - last_stage0 = ce; -/* fallthru */ -default : -continue ; -case 1 : -/* -* If there is stage #0 entry for this, we do not -* need to show it. We use CE_UPDATE bit to mark -* such an entry. -*/ -if (last_stage0 && - !strcmp (last_stage0->name, ce->name)) - ce->ce_flags |=CE_UPDATE ; - } - } -} -static const char *const ls_files_usage[] = {N_ ("git ls-files [<options>] [<file>...]" ),NULL
read-cache.c +137 -0
140 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v3 6/28 add: modify add_files_to_cache() to avoid globals
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The function add_files_to_cache() is used by all three of builtin/{add, checkout, commit}.c. That suggests this is common library code, and should be moved somewhere else, like read-cache.c. However, the function and its helpers made use of two global variables that made straight code movement difficult:
* the_index
* include_sparse
The latter was perhaps more problematic since it was only accessible in builtin/add.c but was still affecting builtin/checkout.c and builtin/commit.c without this fact being very clear from the code. I'm not sure if the other two callers would want to add a --sparse flag similar to add.c to get non-default behavior, but exposing this dependence will help if we ever decide we do want to add such a flag.
Modify add_files_to_cache() and its helpers to accept the necessary arguments instead of relying on globals.
--- builtin/add.c | 22 +++++++++++++++------- builtin/checkout.c | 2 +- builtin/commit.c | 3 ++- cache.h | 4 +++- 4 files changed, 21 insertions(+), 10 deletions(-)
builtin/add.c +15 -7
@@ -37,6 +37,8 @@ static int include_sparse;static const char *pathspec_from_file;struct update_callback_data { +struct index_state *index; +int include_sparse;int flags;int add_errors; };
@@ -100,7 +102,8 @@ static void update_callback(struct diff_queue_struct *q,struct diff_filepair *p = q->queue[i];const char *path = p->one->path; -if (!include_sparse && !path_in_sparse_checkout (path, &the_index)) +if (!data->include_sparse && + !path_in_sparse_checkout (path, data->index))continue ;switch (fix_unmerged_status (p, data)) {
@@ -108,7 +111,7 @@ static void update_callback(struct diff_queue_struct *q,die (_ ("unexpected diff status %c" ), p->status);case DIFF_STATUS_MODIFIED :case DIFF_STATUS_TYPE_CHANGED : -if (add_file_to_index (&the_index, path, data->flags)) { +if (add_file_to_index (data->index, path, data->flags)) {if (!(data->flags &ADD_CACHE_IGNORE_ERRORS ))die (_ ("updating files failed" )); data->add_errors++;
@@ -118,7 +121,7 @@ static void update_callback(struct diff_queue_struct *q,if (data->flags &ADD_CACHE_IGNORE_REMOVAL )break ;if (!(data->flags &ADD_CACHE_PRETEND )) -remove_file_from_index (&the_index, path); +remove_file_from_index (data->index, path);if (data->flags & (ADD_CACHE_PRETEND |ADD_CACHE_VERBOSE ))printf (_ ("remove '%s'\n" ), path);break ;
@@ -126,16 +129,19 @@ static void update_callback(struct diff_queue_struct *q, } } -int add_files_to_cache (const char *prefix, -const struct pathspec *pathspec,int flags) +int add_files_to_cache (struct repository *repo,const char *prefix, +const struct pathspec *pathspec,int include_sparse, +int flags) {struct update_callback_data data;struct rev_info rev;memset (&data,0 ,sizeof (data)); + data.index = repo->index; + data.include_sparse = include_sparse; data.flags = flags; -repo_init_revisions (the_repository, &rev, prefix); +repo_init_revisions (repo, &rev, prefix);setup_revisions (0 ,NULL , &rev,NULL );if (pathspec)copy_pathspec (&rev.prune_data, pathspec);
@@ -640,7 +646,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)if (add_renormalize) exit_status |=renormalize_tracked_files (&pathspec, flags);else - exit_status |=add_files_to_cache (prefix, &pathspec, flags); + exit_status |=add_files_to_cache (the_repository, prefix, + &pathspec, include_sparse, + flags);if (add_new_files) exit_status |=add_files (&dir, flags);
builtin/checkout.c +1 -1
@@ -861,7 +861,7 @@ static int merge_working_tree(const struct checkout_opts *opts,* entries in the index. */ -add_files_to_cache (NULL ,NULL ,0 ); +add_files_to_cache (the_repository,NULL ,NULL ,0 ,0 );init_merge_options (&o, the_repository); o.verbosity =0 ; work =write_in_core_index_as_tree (the_repository);
builtin/commit.c +2 -1
@@ -447,7 +447,8 @@ static const char *prepare_index(const char **argv, const char *prefix,if (all || (also && pathspec.nr)) {repo_hold_locked_index (the_repository, &index_lock,LOCK_DIE_ON_ERROR ); -add_files_to_cache (also ? prefix :NULL , &pathspec,0 ); +add_files_to_cache (the_repository, also ? prefix :NULL , + &pathspec,0 ,0 );refresh_cache_or_die (refresh_flags);cache_tree_update (&the_index,WRITE_TREE_SILENT );if (write_locked_index (&the_index, &index_lock,0 ))
cache.h +3 -1
@@ -554,7 +554,9 @@ int cmp_cache_name_compare(const void *a_, const void *b_);* return 0 if success, 1 - if addition of a file failed and * ADD_FILES_IGNORE_ERRORS was specified in flags */ -int add_files_to_cache (const char *prefix,const struct pathspec *pathspec,int flags); +int add_files_to_cache (struct repository *repo,const char *prefix, +const struct pathspec *pathspec,int include_sparse, +int flags);/* diff.c */ extern int diff_auto_refresh_index;
Signature · 1 line
gitgitgadget
PATCH v3 7/28 read-cache: move shared add/checkout/commit code
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
The function add_files_to_cache(), plus associated helper functions, were defined in builtin/add.c, but also shared with builtin/checkout.c and builtin/commit.c. Move these shared functions to read-cache.c.
Diff best viewed with --color-moved.
--- builtin/add.c | 100 ------------------------------------------------- read-cache.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 100 deletions(-)
builtin/add.c +0 -100
@@ -36,13 +36,6 @@ static int pathspec_file_nul;static int include_sparse;static const char *pathspec_from_file; -struct update_callback_data { -struct index_state *index; -int include_sparse; -int flags; -int add_errors; -}; -static int chmod_pathspec (struct pathspec *pathspec,char flip,int show_only) {int i, ret =0 ;
@@ -71,99 +64,6 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)return ret; } -static int fix_unmerged_status (struct diff_filepair *p, -struct update_callback_data *data) -{ -if (p->status !=DIFF_STATUS_UNMERGED ) -return p->status; -if (!(data->flags &ADD_CACHE_IGNORE_REMOVAL ) && !p->two->mode) -/* -* This is not an explicit add request, and the -* path is missing from the working tree (deleted) -*/ -return DIFF_STATUS_DELETED ; -else -/* -* Either an explicit add request, or path exists -* in the working tree. An attempt to explicitly -* add a path that does not exist in the working tree -* will be caught as an error by the caller immediately. -*/ -return DIFF_STATUS_MODIFIED ; -} - -static void update_callback (struct diff_queue_struct *q, - struct diff_options *opt UNUSED, void *cbdata) -{ -int i; -struct update_callback_data *data = cbdata; - -for (i =0 ; i < q->nr; i++) { -struct diff_filepair *p = q->queue[i]; -const char *path = p->one->path; - -if (!data->include_sparse && - !path_in_sparse_checkout (path, data->index)) -continue ; - -switch (fix_unmerged_status (p, data)) { -default : -die (_ ("unexpected diff status %c" ), p->status); -case DIFF_STATUS_MODIFIED : -case DIFF_STATUS_TYPE_CHANGED : -if (add_file_to_index (data->index, path, data->flags)) { -if (!(data->flags &ADD_CACHE_IGNORE_ERRORS )) -die (_ ("updating files failed" )); - data->add_errors++; - } -break ; -case DIFF_STATUS_DELETED : -if (data->flags &ADD_CACHE_IGNORE_REMOVAL ) -break ; -if (!(data->flags &ADD_CACHE_PRETEND )) -remove_file_from_index (data->index, path); -if (data->flags & (ADD_CACHE_PRETEND |ADD_CACHE_VERBOSE )) -printf (_ ("remove '%s'\n" ), path); -break ; - } - } -} - -int add_files_to_cache (struct repository *repo,const char *prefix, -const struct pathspec *pathspec,int include_sparse, -int flags) -{ -struct update_callback_data data; -struct rev_info rev; - -memset (&data,0 ,sizeof (data)); - data.index = repo->index; - data.include_sparse = include_sparse; - data.flags = flags; - -repo_init_revisions (repo, &rev, prefix); -setup_revisions (0 ,NULL , &rev,NULL ); -if (pathspec) -copy_pathspec (&rev.prune_data, pathspec); - rev.diffopt.output_format =DIFF_FORMAT_CALLBACK ; - rev.diffopt.format_callback = update_callback; - rev.diffopt.format_callback_data = &data; - rev.diffopt.flags.override_submodule_config =1 ; - rev.max_count =0 ;/* do not compare unmerged paths with stage #2 */ - -/* -* Use an ODB transaction to optimize adding multiple objects. -* This function is invoked from commands other than 'add', which -* may not have their own transaction active. -*/ -begin_odb_transaction (); -run_diff_files (&rev,DIFF_RACY_IS_MODIFIED ); -end_odb_transaction (); - -release_revisions (&rev); -return !!data.add_errors; -} -static int renormalize_tracked_files (const struct pathspec *pathspec,int flags) {int i, retval =0 ;
read-cache.c +102 -0
117 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v3 8/28 statinfo: move stat_{data,validity} functions from cache/read-cache
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
These functions do not depend upon struct cache_entry or struct index_state in any way, and it seems more logical to break them out into this file, especially since statinfo.h already has the struct stat_data declaration.
Diff best viewed with --color-moved.
--- Makefile | 1 + cache.h | 48 ------------------------ object.c | 1 + read-cache.c | 84 ----------------------------------------- refs/packed-backend.c | 1 + shallow.c | 1 + statinfo.c | 87 +++++++++++++++++++++++++++++++++++++++++++ statinfo.h | 51 +++++++++++++++++++++++++ 8 files changed, 142 insertions(+), 132 deletions(-) create mode 100644 statinfo.c
Makefile +1 -0
@@ -1142,6 +1142,7 @@ LIB_OBJS += sigchain.o LIB_OBJS += sparse-index.o LIB_OBJS += split-index.o LIB_OBJS += stable-qsort.o +LIB_OBJS += statinfo.o LIB_OBJS += strbuf.o LIB_OBJS += streaming.o LIB_OBJS += string-list.o
cache.h +0 -48
64 lines not on this page · raw message
object.c +1 -0
@@ -6,6 +6,7 @@#include "object-file.h" #include "object-store.h" #include "blob.h" +#include "statinfo.h" #include "tree.h" #include "commit.h" #include "tag.h"
read-cache.c +0 -84
96 lines not on this page · raw message
refs/packed-backend.c +1 -0
@@ -10,6 +10,7 @@#include "../iterator.h" #include "../lockfile.h" #include "../chdir-notify.h" +#include "../statinfo.h" #include "../wrapper.h" #include "../write-or-die.h"
shallow.c +1 -0
@@ -17,6 +17,7 @@#include "list-objects.h" #include "commit-reach.h" #include "shallow.h" +#include "statinfo.h" #include "trace.h" #include "wrapper.h"
statinfo.c new file +87 -0
87 lines not on this page · raw message
statinfo.h +51 -0
61 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v3 9/28 run-command.h: move declarations for run-command.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- cache.h | 3 --- exec-cmd.c | 3 ++- run-command.c | 2 +- run-command.h | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-)
cache.h +0 -3
@@ -555,7 +555,4 @@ int checkout_fast_forward(struct repository *r,const struct object_id *to, int overwrite_ignore); - -int sane_execvp (const char *file,char *const argv[]); -#endif /* CACHE_H */
exec-cmd.c +2 -1
@@ -1,10 +1,11 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "environment.h" #include "exec-cmd.h" #include "gettext.h" #include "path.h" #include "quote.h" +#include "run-command.h" #include "strvec.h" #include "trace.h" #include "trace2.h"
run-command.c +1 -1
@@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "run-command.h" #include "environment.h" #include "exec-cmd.h"
run-command.h +2 -0
@@ -564,4 +564,6 @@ enum start_bg_result start_bg_command(struct child_process *cmd,void *cb_data, unsigned int timeout_sec); +int sane_execvp (const char *file,char *const argv[]); +#endif
Signature · 1 line
gitgitgadget
PATCH v3 10/28 name-hash.h: move declarations for name-hash.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- apply.c | 1 + builtin/mv.c | 1 + cache.h | 9 --------- dir.c | 1 + entry.c | 1 + merge-recursive.c | 1 + name-hash.c | 1 + name-hash.h | 16 ++++++++++++++++ read-cache.c | 1 + sparse-index.c | 1 + t/helper/test-lazy-init-name-hash.c | 1 + unpack-trees.c | 1 + 12 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 name-hash.h
apply.c +1 -0
@@ -23,6 +23,7 @@#include "xdiff-interface.h" #include "ll-merge.h" #include "lockfile.h" +#include "name-hash.h" #include "object-name.h" #include "object-file.h" #include "parse-options.h"
builtin/mv.c +1 -0
@@ -11,6 +11,7 @@#include "config.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "object-file.h" #include "pathspec.h" #include "lockfile.h"
cache.h +0 -9
@@ -245,12 +245,6 @@ struct index_state {void index_state_init (struct index_state *istate,struct repository *r);void release_index (struct index_state *istate); -/* Name hashing */ -int test_lazy_init_name_hash (struct index_state *istate,int try_threaded); -void add_name_hash (struct index_state *istate,struct cache_entry *ce); -void remove_name_hash (struct index_state *istate,struct cache_entry *ce); -void free_name_hash (struct index_state *istate); -/* Cache entry creation and cleanup */ /*
@@ -377,9 +371,6 @@ int repo_index_has_changes(struct repository *repo,int verify_path (const char *path,unsigned mode);int strcmp_offset (const char *s1,const char *s2,size_t *first_change); -int index_dir_exists (struct index_state *istate,const char *name,int namelen); -void adjust_dirname_case (struct index_state *istate,char *name); -struct cache_entry *index_file_exists (struct index_state *istate,const char *name,int namelen,int igncase);/* * Searches for an entry defined by name and namelen in the given index.
dir.c +1 -0
@@ -13,6 +13,7 @@#include "dir.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "object-file.h" #include "object-store.h" #include "attr.h"
entry.c +1 -0
@@ -5,6 +5,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "name-hash.h" #include "streaming.h" #include "submodule.h" #include "symlinks.h"
merge-recursive.c +1 -0
@@ -23,6 +23,7 @@#include "ll-merge.h" #include "lockfile.h" #include "match-trees.h" +#include "name-hash.h" #include "object-file.h" #include "object-name.h" #include "object-store.h"
name-hash.c +1 -0
@@ -8,6 +8,7 @@#include "cache.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "thread-utils.h" #include "trace.h" #include "trace2.h"
name-hash.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef NAME_HASH_H +#define NAME_HASH_H + +struct cache_entry ; +struct index_state ; + +int index_dir_exists (struct index_state *istate,const char *name,int namelen); +void adjust_dirname_case (struct index_state *istate,char *name); +struct cache_entry *index_file_exists (struct index_state *istate,const char *name,int namelen,int igncase); + +int test_lazy_init_name_hash (struct index_state *istate,int try_threaded); +void add_name_hash (struct index_state *istate,struct cache_entry *ce); +void remove_name_hash (struct index_state *istate,struct cache_entry *ce); +void free_name_hash (struct index_state *istate); + +#endif /* NAME_HASH_H */
read-cache.c +1 -0
@@ -25,6 +25,7 @@#include "environment.h" #include "gettext.h" #include "mem-pool.h" +#include "name-hash.h" #include "object-name.h" #include "resolve-undo.h" #include "revision.h"
sparse-index.c +1 -0
@@ -2,6 +2,7 @@#include "alloc.h" #include "environment.h" #include "gettext.h" +#include "name-hash.h" #include "repository.h" #include "sparse-index.h" #include "tree.h"
t/helper/test-lazy-init-name-hash.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "environment.h" +#include "name-hash.h" #include "parse-options.h" #include "repository.h" #include "setup.h"
unpack-trees.c +1 -0
@@ -7,6 +7,7 @@#include "environment.h" #include "gettext.h" #include "hex.h" +#include "name-hash.h" #include "tree.h" #include "tree-walk.h" #include "cache-tree.h"
Signature · 1 line
gitgitgadget
PATCH v3 11/28 sparse-index.h: move declarations for sparse-index.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
Note in particular that this reverses the decision made in 118a2e8bde0 ("cache: move ensure_full_index() to cache.h", 2021-04-01).
--- builtin/checkout-index.c | 1 + builtin/commit.c | 1 + builtin/difftool.c | 1 + builtin/fsck.c | 1 + builtin/ls-files.c | 1 + builtin/merge-index.c | 1 + builtin/read-tree.c | 1 + builtin/reset.c | 1 + builtin/rm.c | 1 + builtin/stash.c | 1 + builtin/submodule--helper.c | 1 + builtin/update-index.c | 1 + cache.h | 2 -- dir.c | 1 + entry.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + resolve-undo.c | 1 + revision.c | 1 + sequencer.c | 1 + sparse-index.h | 2 ++ 21 files changed, 21 insertions(+), 2 deletions(-)
builtin/checkout-index.c +1 -0
@@ -17,6 +17,7 @@#include "entry.h" #include "parallel-checkout.h" #include "setup.h" +#include "sparse-index.h" #define CHECKOUT_ALL 4static int nul_term_line;
builtin/commit.c +1 -0
@@ -38,6 +38,7 @@#include "gpg-interface.h" #include "column.h" #include "sequencer.h" +#include "sparse-index.h" #include "mailmap.h" #include "help.h" #include "commit-reach.h"
builtin/difftool.c +1 -0
@@ -23,6 +23,7 @@#include "gettext.h" #include "hex.h" #include "parse-options.h" +#include "sparse-index.h" #include "strvec.h" #include "strbuf.h" #include "lockfile.h"
builtin/fsck.c +1 -0
@@ -25,6 +25,7 @@#include "replace-object.h" #include "resolve-undo.h" #include "run-command.h" +#include "sparse-index.h" #include "worktree.h" #include "pack-revindex.h"
builtin/ls-files.c +1 -0
@@ -23,6 +23,7 @@#include "pathspec.h" #include "run-command.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h"
builtin/merge-index.c +1 -0
@@ -3,6 +3,7 @@#include "hex.h" #include "repository.h" #include "run-command.h" +#include "sparse-index.h" static const char *pgm;static int one_shot, quiet;
builtin/read-tree.c +1 -0
@@ -22,6 +22,7 @@#include "repository.h" #include "resolve-undo.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h"
builtin/reset.c +1 -0
@@ -29,6 +29,7 @@#include "unpack-trees.h" #include "cache-tree.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h" #include "trace.h"
builtin/rm.c +1 -0
@@ -19,6 +19,7 @@#include "repository.h" #include "string-list.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "pathspec.h"
builtin/stash.c +1 -0
@@ -20,6 +20,7 @@#include "rerere.h" #include "revision.h" #include "setup.h" +#include "sparse-index.h" #include "log-tree.h" #include "diffcore.h" #include "exec-cmd.h"
builtin/submodule--helper.c +1 -0
@@ -13,6 +13,7 @@#include "pathspec.h" #include "dir.h" #include "setup.h" +#include "sparse-index.h" #include "submodule.h" #include "submodule-config.h" #include "string-list.h"
builtin/update-index.c +1 -0
@@ -24,6 +24,7 @@#include "dir.h" #include "repository.h" #include "setup.h" +#include "sparse-index.h" #include "split-index.h" #include "symlinks.h" #include "fsmonitor.h"
cache.h +0 -2
@@ -327,8 +327,6 @@ int read_index_from(struct index_state *, const char *path, const char *gitdir);int is_index_unborn (struct index_state *); -void ensure_full_index (struct index_state *istate); -/* For use with `write_locked_index()`. */ #define COMMIT_LOCK (1 << 0)#define SKIP_IF_UNCHANGED (1 << 1)
dir.c +1 -0
@@ -25,6 +25,7 @@#include "ewah/ewok.h" #include "fsmonitor.h" #include "setup.h" +#include "sparse-index.h" #include "submodule-config.h" #include "symlinks.h" #include "trace2.h"
entry.c +1 -0
@@ -6,6 +6,7 @@#include "gettext.h" #include "hex.h" #include "name-hash.h" +#include "sparse-index.h" #include "streaming.h" #include "submodule.h" #include "symlinks.h"
merge-ort.c +1 -0
@@ -38,6 +38,7 @@#include "oid-array.h" #include "promisor-remote.h" #include "revision.h" +#include "sparse-index.h" #include "strmap.h" #include "submodule-config.h" #include "submodule.h"
merge-recursive.c +1 -0
@@ -29,6 +29,7 @@#include "object-store.h" #include "repository.h" #include "revision.h" +#include "sparse-index.h" #include "string-list.h" #include "submodule-config.h" #include "submodule.h"
resolve-undo.c +1 -0
@@ -2,6 +2,7 @@#include "dir.h" #include "hash.h" #include "resolve-undo.h" +#include "sparse-index.h" #include "string-list.h" /* The only error case is to run out of memory in string-list */
revision.c +1 -0
@@ -32,6 +32,7 @@#include "packfile.h" #include "worktree.h" #include "setup.h" +#include "sparse-index.h" #include "strvec.h" #include "trace2.h" #include "commit-reach.h"
sequencer.c +1 -0
@@ -28,6 +28,7 @@#include "merge-ort.h" #include "merge-ort-wrappers.h" #include "refs.h" +#include "sparse-index.h" #include "strvec.h" #include "quote.h" #include "trailer.h"
sparse-index.h +2 -0
@@ -37,4 +37,6 @@ struct pattern_list;*/ void expand_index (struct index_state *istate,struct pattern_list *pl); +void ensure_full_index (struct index_state *istate); +#endif
Signature · 1 line
gitgitgadget
PATCH v3 12/28 preload-index.h: move declarations for preload-index.c from elsewhere
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
We already have a preload-index.c file; move the declarations for the functions in that file into a new preload-index.h. These were previously split between cache.h and repository.h.
--- add-interactive.c | 1 + builtin/add.c | 1 + builtin/am.c | 1 + builtin/checkout.c | 1 + builtin/commit.c | 1 + builtin/diff-files.c | 1 + builtin/diff-index.c | 1 + builtin/diff.c | 1 + builtin/stash.c | 1 + builtin/submodule--helper.c | 1 + cache.h | 3 --- preload-index.c | 1 + preload-index.h | 15 +++++++++++++++ read-cache.c | 1 + repository.h | 3 --- 15 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 preload-index.h
add-interactive.c +1 -0
@@ -5,6 +5,7 @@#include "diffcore.h" #include "gettext.h" #include "hex.h" +#include "preload-index.h" #include "revision.h" #include "refs.h" #include "string-list.h"
builtin/add.c +1 -0
@@ -17,6 +17,7 @@#include "cache-tree.h" #include "run-command.h" #include "parse-options.h" +#include "preload-index.h" #include "diff.h" #include "diffcore.h" #include "revision.h"
builtin/am.c +1 -0
@@ -29,6 +29,7 @@#include "unpack-trees.h" #include "branch.h" #include "object-name.h" +#include "preload-index.h" #include "sequencer.h" #include "revision.h" #include "merge-recursive.h"
builtin/checkout.c +1 -0
@@ -20,6 +20,7 @@#include "object-name.h" #include "object-store.h" #include "parse-options.h" +#include "preload-index.h" #include "refs.h" #include "remote.h" #include "resolve-undo.h"
builtin/commit.c +1 -0
@@ -30,6 +30,7 @@#include "utf8.h" #include "object-name.h" #include "parse-options.h" +#include "preload-index.h" #include "string-list.h" #include "rerere.h" #include "unpack-trees.h"
builtin/diff-files.c +1 -0
@@ -8,6 +8,7 @@#include "diff.h" #include "diff-merges.h" #include "commit.h" +#include "preload-index.h" #include "revision.h" #include "builtin.h" #include "submodule.h"
builtin/diff-index.c +1 -0
@@ -3,6 +3,7 @@#include "diff.h" #include "diff-merges.h" #include "commit.h" +#include "preload-index.h" #include "revision.h" #include "builtin.h" #include "setup.h"
builtin/diff.c +1 -0
@@ -16,6 +16,7 @@#include "diff.h" #include "diff-merges.h" #include "diffcore.h" +#include "preload-index.h" #include "revision.h" #include "log-tree.h" #include "builtin.h"
builtin/stash.c +1 -0
@@ -17,6 +17,7 @@#include "run-command.h" #include "dir.h" #include "entry.h" +#include "preload-index.h" #include "rerere.h" #include "revision.h" #include "setup.h"
builtin/submodule--helper.c +1 -0
@@ -11,6 +11,7 @@#include "parse-options.h" #include "quote.h" #include "pathspec.h" +#include "preload-index.h" #include "dir.h" #include "setup.h" #include "sparse-index.h"
cache.h +0 -3
@@ -318,9 +318,6 @@ extern struct index_state the_index;/* Initialize and use the cache information */ struct lock_file ; -void preload_index (struct index_state *index, -const struct pathspec *pathspec, -unsigned int refresh_flags);int do_read_index (struct index_state *istate,const char *path,int must_exist);/* for testting only! */ int read_index_from(struct index_state *, const char *path,
preload-index.c +1 -0
@@ -8,6 +8,7 @@#include "fsmonitor.h" #include "gettext.h" #include "config.h" +#include "preload-index.h" #include "progress.h" #include "thread-utils.h" #include "repository.h"
preload-index.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef PRELOAD_INDEX_H +#define PRELOAD_INDEX_H + +struct index_state ; +struct pathspec ; +struct repository ; + +void preload_index (struct index_state *index, +const struct pathspec *pathspec, +unsigned int refresh_flags); +int repo_read_index_preload (struct repository *, +const struct pathspec *pathspec, +unsigned refresh_flags); + +#endif /* PRELOAD_INDEX_H */
read-cache.c +1 -0
@@ -27,6 +27,7 @@#include "mem-pool.h" #include "name-hash.h" #include "object-name.h" +#include "preload-index.h" #include "resolve-undo.h" #include "revision.h" #include "run-command.h"
repository.h +0 -3
@@ -220,9 +220,6 @@ int repo_hold_locked_index(struct repository *repo,struct lock_file *lf, int flags); -int repo_read_index_preload (struct repository *, -const struct pathspec *pathspec, -unsigned refresh_flags);int repo_read_index_unmerged (struct repository *);/* * Opportunistically update the index but do not complain if we can't.
Signature · 1 line
gitgitgadget
PATCH v3 13/28 diff.h: move declaration for global in diff.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- cache.h | 3 --- diff.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-)
cache.h +0 -3
@@ -523,9 +523,6 @@ int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, int include_sparse, int flags); -/* diff.c */ -extern int diff_auto_refresh_index; -/* ls-files */ void overlay_tree_on_index (struct index_state *istate,const char *tree_name,const char *prefix);
diff.h +2 -0
@@ -694,4 +694,6 @@ void print_stat_summary(FILE *fp, int files, int insertions, int deletions);void setup_diff_pager (struct diff_options *); +extern int diff_auto_refresh_index; +#endif /* DIFF_H */
Signature · 1 line
gitgitgadget
PATCH v3 14/28 merge.h: move declarations for merge.c from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
--- builtin/merge.c | 1 + builtin/pull.c | 1 + cache.h | 11 ----------- merge.c | 1 + merge.h | 17 +++++++++++++++++ sequencer.c | 1 + 6 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 merge.h
builtin/merge.c +1 -0
@@ -37,6 +37,7 @@#include "color.h" #include "rerere.h" #include "help.h" +#include "merge.h" #include "merge-recursive.h" #include "merge-ort-wrappers.h" #include "resolve-undo.h"
builtin/pull.c +1 -0
@@ -12,6 +12,7 @@#include "builtin.h" #include "gettext.h" #include "hex.h" +#include "merge.h" #include "object-name.h" #include "parse-options.h" #include "exec-cmd.h"
cache.h +0 -11
@@ -527,15 +527,4 @@ int add_files_to_cache(struct repository *repo, const char *prefix,void overlay_tree_on_index (struct index_state *istate,const char *tree_name,const char *prefix); -/* merge.c */ -struct commit_list ; -int try_merge_command (struct repository *r, -const char *strategy,size_t xopts_nr, -const char **xopts,struct commit_list *common, -const char *head_arg,struct commit_list *remotes); -int checkout_fast_forward (struct repository *r, -const struct object_id *from, -const struct object_id *to, -int overwrite_ignore); -#endif /* CACHE_H */
merge.c +1 -0
@@ -4,6 +4,7 @@#include "gettext.h" #include "hex.h" #include "lockfile.h" +#include "merge.h" #include "commit.h" #include "run-command.h" #include "resolve-undo.h"
merge.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef MERGE_H +#define MERGE_H + +struct commit_list ; +struct object_id ; +struct repository ; + +int try_merge_command (struct repository *r, +const char *strategy,size_t xopts_nr, +const char **xopts,struct commit_list *common, +const char *head_arg,struct commit_list *remotes); +int checkout_fast_forward (struct repository *r, +const struct object_id *from, +const struct object_id *to, +int overwrite_ignore); + +#endif /* MERGE_H */
sequencer.c +1 -0
@@ -25,6 +25,7 @@#include "diff.h" #include "revision.h" #include "rerere.h" +#include "merge.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" #include "refs.h"
Signature · 1 line
gitgitgadget
PATCH v3 15/28 repository.h: move declaration of the_index from cache.h
In reply to Elijah Newren via GitGitGadgetFrom: Elijah Newren <[email protected]>
the_index is a global variable defined in repository.c; as such, its declaration feels better suited living in repository.h rather than cache.h. Move it.
--- cache.h | 4 ---- repository.h | 3 +++ t/helper/test-dump-split-index.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-)
cache.h +0 -4
@@ -312,10 +312,6 @@ typedef int (*must_prefetch_predicate)(const struct cache_entry *);void prefetch_cache_entries (const struct index_state *istate,must_prefetch_predicate must_prefetch); -#ifdef USE_THE_INDEX_VARIABLE -extern struct index_state the_index; -#endif -/* Initialize and use the cache information */ struct lock_file ; int do_read_index(struct index_state *istate, const char *path,
repository.h +3 -0
@@ -169,6 +169,9 @@ struct repository { };extern struct repository *the_repository; +#ifdef USE_THE_INDEX_VARIABLE +extern struct index_state the_index; +#endif /* * Define a custom repository layout. Any field can be NULL, which
t/helper/test-dump-split-index.c +1 -0
@@ -2,6 +2,7 @@#include "test-tool.h" #include "cache.h" #include "hex.h" +#include "repository.h" #include "setup.h" #include "split-index.h" #include "ewah/ewok.h"
Signature · 1 line
gitgitgadget