diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-04-05 10:43:18 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2017-04-05 13:49:31 +0200 |
commit | 5b65ac25780cc4c18c965e3202e2e882bd25d941 (patch) | |
tree | 76c239117cc35d15d10e6389064df8b9b3ec7cdc /src/refs.h | |
parent | 602972560a9c8700b1819430f409ce0cb8fbd58f (diff) | |
download | libgit2-5b65ac25780cc4c18c965e3202e2e882bd25d941.tar.gz |
refs: implement function to read references from file
Currently, we only provide functions to read references directly from a
repository's reference store via e.g. `git_reference_lookup`. But in
some cases, we may want to read files not connected to the current
repository, e.g. when looking up HEAD of connected work trees. This
commit implements `git_reference__read_head`, which will read out and
allocate a reference at an arbitrary path.
Diffstat (limited to 'src/refs.h')
-rw-r--r-- | src/refs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/refs.h b/src/refs.h index 80e655af7..0c90db3af 100644 --- a/src/refs.h +++ b/src/refs.h @@ -107,6 +107,20 @@ int git_reference_lookup_resolved( const char *name, int max_deref); +/** + * Read reference from a file. + * + * This function will read in the file at `path`. If it is a + * symref, it will return a new unresolved symbolic reference + * with the given name pointing to the reference pointed to by + * the file. If it is not a symbolic reference, it will return + * the resolved reference. + */ +int git_reference__read_head( + git_reference **out, + git_repository *repo, + const char *path); + int git_reference__log_signature(git_signature **out, git_repository *repo); /** Update a reference after a commit. */ |