summaryrefslogtreecommitdiff
path: root/include/git2/refs.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-05-07 23:28:21 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-05-07 23:34:48 +0200
commit98d633cccf0a214b83ebfe9c7cb8ca449a1f0637 (patch)
tree6ed6d4a0f9bbd3b24175f4dd3016cf5f55536d3a /include/git2/refs.h
parent3405f78754703948475b4677d03fcdbfb099b6a4 (diff)
downloadlibgit2-98d633cccf0a214b83ebfe9c7cb8ca449a1f0637.tar.gz
Expose git_reference_dwim
Extract this function out of the rev-parse code to be able to DWIM a reference instead of its target.
Diffstat (limited to 'include/git2/refs.h')
-rw-r--r--include/git2/refs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index e1d425352..e78873408 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -55,6 +55,19 @@ GIT_EXTERN(int) git_reference_name_to_id(
git_oid *out, git_repository *repo, const char *name);
/**
+ * Lookup a reference by DWIMing its short name
+ *
+ * Apply the git precendence rules to the given shorthand to determine
+ * which reference the user is refering to.
+ *
+ * @param out pointer in which to store the reference
+ * @param repo the repository in which to look
+ * @param shrothand the short name for the reference
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_reference_dwim(git_reference **out, git_repository *repo, const char *shorthand);
+
+/**
* Create a new symbolic reference.
*
* A symbolic reference is a reference name that refers to another