Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-10-31 08:58:33 +0400
committerVicent Marti <tanoku@gmail.com>2011-11-06 06:15:34 +0400
commitd4a0b124d00c70933d7c6ac9065c401cc2d70b2e (patch)
tree91eb5968ad1bddb18a121c30afb1f6a1af00d194 /src/refs.h
parent549bbd1342499c2659388a483f1a266dfcedab85 (diff)
refs: Partial rewrite for read-only refs
This new version of the references code is significantly faster and hopefully easier to read. External API stays the same. A new method `git_reference_reload()` has been added to force updating a memory reference from disk. In-memory references are no longer updated automagically -- this was killing us. If a reference is deleted externally and the user doesn't reload the memory object, nothing critical happens: any functions using that reference should fail gracefully (e.g. deletion, renaming, and so on). All generated references from the API are read only and must be free'd by the user. There is no reference counting and no traces of generated references are kept in the library. There is no longer an internal representation for references. There is only one reference struct `git_reference`, and symbolic/oid targets are stored inside an union. Packfile references are stored using an optimized struct with flex array for reference names. This should significantly reduce the memory cost of loading the packfile from disk.
Diffstat (limited to 'src/refs.h')
-rw-r--r--src/refs.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/refs.h b/src/refs.h
index db0f5c4df..02e336e54 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -33,19 +33,23 @@
#define GIT_REFNAME_MAX 1024
struct git_reference {
+ unsigned int flags;
git_repository *owner;
char *name;
+ time_t mtime;
+
+ union {
+ git_oid oid;
+ char *symbolic;
+ } target;
};
typedef struct {
git_hashtable *packfile;
- git_hashtable *loose_cache;
time_t packfile_time;
} git_refcache;
-
void git_repository__refcache_free(git_refcache *refs);
-int git_repository__refcache_init(git_refcache *refs);
int git_reference__normalize_name(char *buffer_out, size_t out_size, const char *name);
int git_reference__normalize_name_oid(char *buffer_out, size_t out_size, const char *name);