diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-02-06 22:05:22 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-02-06 22:05:23 -0800 |
commit | 7589e63648bf5224e186990931b1491f36e10a4b (patch) | |
tree | dfd3004e735b69ae91dc08ac4f742f1cb84eae5d /cache.h | |
parent | Merge branch 'js/rebase-am' (diff) | |
parent | cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch (diff) | |
download | tgif-7589e63648bf5224e186990931b1491f36e10a4b.tar.xz |
Merge branch 'nd/the-index-final'
The assumption to work on the single "in-core index" instance has
been reduced from the library-ish part of the codebase.
* nd/the-index-final:
cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch
read-cache.c: remove the_* from index_has_changes()
merge-recursive.c: remove implicit dependency on the_repository
merge-recursive.c: remove implicit dependency on the_index
sha1-name.c: remove implicit dependency on the_index
read-cache.c: replace update_index_if_able with repo_&
read-cache.c: kill read_index()
checkout: avoid the_index when possible
repository.c: replace hold_locked_index() with repo_hold_locked_index()
notes-utils.c: remove the_repository references
grep: use grep_opt->repo instead of explict repo argument
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 36 |
1 files changed, 13 insertions, 23 deletions
@@ -348,8 +348,6 @@ struct index_state { struct mem_pool *ce_mem_pool; }; -extern struct index_state the_index; - /* Name hashing */ extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded); extern void add_name_hash(struct index_state *istate, struct cache_entry *ce); @@ -411,18 +409,20 @@ struct cache_entry *dup_cache_entry(const struct cache_entry *ce, struct index_s */ void validate_cache_entries(const struct index_state *istate); -#ifndef NO_THE_INDEX_COMPATIBILITY_MACROS +#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS +extern struct index_state the_index; + #define active_cache (the_index.cache) #define active_nr (the_index.cache_nr) #define active_alloc (the_index.cache_alloc) #define active_cache_changed (the_index.cache_changed) #define active_cache_tree (the_index.cache_tree) -#define read_cache() read_index(&the_index) +#define read_cache() repo_read_index(the_repository) #define read_cache_from(path) read_index_from(&the_index, (path), (get_git_dir())) -#define read_cache_preload(pathspec) read_index_preload(&the_index, (pathspec), 0) +#define read_cache_preload(pathspec) repo_read_index_preload(the_repository, (pathspec), 0) #define is_cache_unborn() is_index_unborn(&the_index) -#define read_cache_unmerged() read_index_unmerged(&the_index) +#define read_cache_unmerged() repo_read_index_unmerged(the_repository) #define discard_cache() discard_index(&the_index) #define unmerged_cache() unmerged_index(&the_index) #define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen)) @@ -443,6 +443,7 @@ void validate_cache_entries(const struct index_state *istate); #define unmerge_cache_entry_at(at) unmerge_index_entry_at(&the_index, at) #define unmerge_cache(pathspec) unmerge_index(&the_index, pathspec) #define read_blob_data_from_cache(path, sz) read_blob_data_from_index(&the_index, (path), (sz)) +#define hold_locked_index(lock_file, flags) repo_hold_locked_index(the_repository, (lock_file), (flags)) #endif #define TYPE_BITS 3 @@ -670,19 +671,14 @@ extern int daemonize(void); /* Initialize and use the cache information */ struct lock_file; -extern int read_index(struct index_state *); extern void preload_index(struct index_state *index, const struct pathspec *pathspec, unsigned int refresh_flags); -extern int read_index_preload(struct index_state *, - const struct pathspec *pathspec, - unsigned int refresh_flags); extern int do_read_index(struct index_state *istate, const char *path, int must_exist); /* for testting only! */ extern int read_index_from(struct index_state *, const char *path, const char *gitdir); extern int is_index_unborn(struct index_state *); -extern int read_index_unmerged(struct index_state *); /* For use with `write_locked_index()`. */ #define COMMIT_LOCK (1 << 0) @@ -720,9 +716,9 @@ extern int unmerged_index(const struct index_state *); * provided, the space-separated list of files that differ will be appended * to it. */ -extern int index_has_changes(struct index_state *istate, - struct tree *tree, - struct strbuf *sb); +extern int repo_index_has_changes(struct repository *repo, + struct tree *tree, + struct strbuf *sb); extern int verify_path(const char *path, unsigned mode); extern int strcmp_offset(const char *s1, const char *s2, size_t *first_change); @@ -838,13 +834,6 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); extern int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg); extern struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry *, unsigned int); -/* - * Opportunistically update the index but do not complain if we can't. - * The lockfile is always committed or rolled back. - */ -extern void update_index_if_able(struct index_state *, struct lock_file *); - -extern int hold_locked_index(struct lock_file *, int); extern void set_alternate_index_output(const char *); extern int verify_index_checksum; @@ -1370,8 +1359,9 @@ extern int get_oid_tree(const char *str, struct object_id *oid); extern int get_oid_treeish(const char *str, struct object_id *oid); extern int get_oid_blob(const char *str, struct object_id *oid); extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix); -extern enum get_oid_result get_oid_with_context(const char *str, unsigned flags, struct object_id *oid, struct object_context *oc); - +extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str, + unsigned flags, struct object_id *oid, + struct object_context *oc); typedef int each_abbrev_fn(const struct object_id *oid, void *); extern int for_each_abbrev(const char *prefix, each_abbrev_fn, void *); |