diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2013-11-23 14:39:53 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-12-09 15:55:11 +0100 |
| commit | f21051297cc698644ea0dc9c7122ec944dba2863 (patch) | |
| tree | b94a20b868860f84c5a674bbada254e789f4e43a /src/refs.c | |
| parent | 8d5ec9106afbca346a8def84ef20de0a7ba2240a (diff) | |
| download | libgit2-f21051297cc698644ea0dc9c7122ec944dba2863.tar.gz | |
refs: expose has_log() on the backend
The frontend used to look at the file directly, but that's obviously not
the right thing to do. Expose it on the backend and use that function
instead.
Diffstat (limited to 'src/refs.c')
| -rw-r--r-- | src/refs.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/refs.c b/src/refs.c index 902a17cfc..519770d2d 100644 --- a/src/refs.c +++ b/src/refs.c @@ -1050,22 +1050,17 @@ int git_reference__update_terminal( return reference__update_terminal(repo, ref_name, oid, 0); } -int git_reference_has_log( - git_reference *ref) +int git_reference_has_log(git_repository *repo, const char *refname) { - git_buf path = GIT_BUF_INIT; - int result; - - assert(ref); + int error; + git_refdb *refdb; - if (git_buf_join_n(&path, '/', 3, ref->db->repo->path_repository, - GIT_REFLOG_DIR, ref->name) < 0) - return -1; + assert(repo && refname); - result = git_path_isfile(git_buf_cstr(&path)); - git_buf_free(&path); + if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0) + return error; - return result; + return git_refdb_has_log(refdb, refname); } int git_reference_ensure_log(git_repository *repo, const char *refname) |
