diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-04-16 08:41:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-16 21:32:46 -0700 |
commit | 7c22bc8a18744cbd79436a8ce598a0dd5d49869b (patch) | |
tree | 3daf30ca84cfb8009d6964fd4708480e22eb510d /refs/ref-cache.h | |
parent | refs: split `ref_cache` code into separate files (diff) | |
download | tgif-7c22bc8a18744cbd79436a8ce598a0dd5d49869b.tar.xz |
ref-cache: introduce a new type, ref_cache
For now, it just wraps a `ref_entry *` that points at the root of the
tree. Soon it will hold more information.
Add two new functions, `create_ref_cache()` and `free_ref_cache()`.
Make `free_ref_entry()` private.
Change files-backend to use this type to hold its caches.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/ref-cache.h')
-rw-r--r-- | refs/ref-cache.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/refs/ref-cache.h b/refs/ref-cache.h index 2e7b1a366e..da5388c136 100644 --- a/refs/ref-cache.h +++ b/refs/ref-cache.h @@ -1,6 +1,10 @@ #ifndef REFS_REF_CACHE_H #define REFS_REF_CACHE_H +struct ref_cache { + struct ref_entry *root; +}; + /* * Information used (along with the information in ref_entry) to * describe a single cached reference. This data structure only @@ -165,7 +169,16 @@ struct ref_entry *create_ref_entry(const char *refname, const unsigned char *sha1, int flag, int check_name); -void free_ref_entry(struct ref_entry *entry); +/* + * Return a pointer to a new `ref_cache`. Its top-level starts out + * marked incomplete. + */ +struct ref_cache *create_ref_cache(struct files_ref_store *refs); + +/* + * Free the `ref_cache` and all of its associated data. + */ +void free_ref_cache(struct ref_cache *cache); /* * Add a ref_entry to the end of dir (unsorted). Entry is always |