summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-11-23 14:13:01 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-12-09 15:55:11 +0100
commit8d5ec9106afbca346a8def84ef20de0a7ba2240a (patch)
tree83dea84e33442fa8e4c58321a246b08b52c5fc0e /src/refs.c
parent6f13a30565fc3891c0df161945097b316945fca7 (diff)
downloadlibgit2-8d5ec9106afbca346a8def84ef20de0a7ba2240a.tar.gz
refs: expose a way to ensure a ref has a log
Sometimes (e.g. stash) we want to make sure that a log will be written, even if it's not in one of the standard locations. Let's make that easier.
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/refs.c b/src/refs.c
index 598d6873c..902a17cfc 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1068,6 +1068,19 @@ int git_reference_has_log(
return result;
}
+int git_reference_ensure_log(git_repository *repo, const char *refname)
+{
+ int error;
+ git_refdb *refdb;
+
+ assert(repo && refname);
+
+ if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
+ return error;
+
+ return git_refdb_ensure_log(refdb, refname);
+}
+
int git_reference__is_branch(const char *ref_name)
{
return git__prefixcmp(ref_name, GIT_REFS_HEADS_DIR) == 0;