Commit 5434f9a3 by Patrick Steinhardt

refs: remove function to read HEAD directly

With the last user of `git_reference__read_head` gone, let's remove it
as it's been reading references without consulting the refdb backends.
parent 65895410
......@@ -263,40 +263,6 @@ int git_reference_lookup_resolved(
return 0;
}
int git_reference__read_head(
git_reference **out,
git_repository *repo,
const char *path)
{
git_buf reference = GIT_BUF_INIT;
char *name = NULL;
int error;
if ((error = git_futils_readbuffer(&reference, path)) < 0)
goto out;
git_buf_rtrim(&reference);
if (git__strncmp(reference.ptr, GIT_SYMREF, strlen(GIT_SYMREF)) == 0) {
git_buf_consume(&reference, reference.ptr + strlen(GIT_SYMREF));
name = git_path_basename(path);
if ((*out = git_reference__alloc_symbolic(name, reference.ptr)) == NULL) {
error = -1;
goto out;
}
} else {
if ((error = git_reference_lookup(out, repo, reference.ptr)) < 0)
goto out;
}
out:
git__free(name);
git_buf_dispose(&reference);
return error;
}
int git_reference_dwim(git_reference **out, git_repository *repo, const char *refname)
{
int error = 0, i;
......
......@@ -116,24 +116,6 @@ 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.
*
* Note that because the refdb is not involved for symbolic references, they
* won't be owned, hence you should either not make the returned reference
* 'externally visible', or perform the lookup before returning it to the user.
*/
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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment