diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-01-29 01:56:25 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-01-30 02:35:29 +0200 |
| commit | 2f8a8ab24b034cb91e6ce80a7aa8cc330b7baebf (patch) | |
| tree | 4729e6dc622a3c5a5da31f126b2e03091c597e14 /src/refs.h | |
| parent | 9282e921a394d422188ee43e18a63d418f88ac95 (diff) | |
| download | libgit2-2f8a8ab24b034cb91e6ce80a7aa8cc330b7baebf.tar.gz | |
Refactor reference parsing code
Several changes have been committed to allow the user to create
in-memory references and write back to disk. Peeling of symbolic
references has been made explicit. Added getter and setter methods for
all attributes on a reference. Added corresponding documentation.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/refs.h')
| -rw-r--r-- | src/refs.h | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/refs.h b/src/refs.h index 3cfd46d58..f19d87894 100644 --- a/src/refs.h +++ b/src/refs.h @@ -9,40 +9,32 @@ #define GIT_REFS_HEADS_DIR GIT_REFS_DIR "heads/" #define GIT_REFS_TAGS_DIR GIT_REFS_DIR "tags/" -#define GIT_SYMREF "ref:" +#define GIT_SYMREF "ref: " #define GIT_PACKEDREFS_FILE "packed-refs" #define GIT_PACKEDREFS_HEADER "# pack-refs with: peeled \n" #define MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH 100 struct git_reference { + git_repository *owner; git_rtype type; char *name; - unsigned is_packed:1; -}; - -struct git_reference_object_id { - git_reference base; + unsigned packed:1, + modified:1; - git_oid id; + union { + char *ref; + git_oid oid; + } target; }; -struct git_reference_symbolic { - git_reference base; +typedef struct { + git_hashtable *cache; + unsigned pack_loaded:1; +} git_refcache; + - git_reference *target; -}; +void git_repository__refcache_free(git_refcache *refs); +int git_repository__refcache_init(git_refcache *refs); -typedef struct { - git_hashtable *references; - - unsigned is_fully_loaded:1; - unsigned have_packed_refs_been_parsed:1; - unsigned is_busy:1; -} git_reference_database; - -git_reference_database *git_reference_database__alloc(); -void git_reference_database__free(git_reference_database *ref_database); -int git_reference_lookup(git_reference **reference_out, git_reference_database *ref_database, const char *name, const char *path_repository, int *nesting_level); - -#endif
\ No newline at end of file +#endif |
