summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-28 15:11:15 -0500
committerEdward Thomson <ethomson@github.com>2016-02-28 18:54:39 -0500
commit98c341496f276aa93737fd6ac71a23b77249d82d (patch)
treefe5d1c567fdb2204ab2b11247266423fec3910fd /src
parent3ef01e772729f44c2871b590577cc64e4a58a381 (diff)
downloadlibgit2-98c341496f276aa93737fd6ac71a23b77249d82d.tar.gz
refs: honor strict object creation
Diffstat (limited to 'src')
-rw-r--r--src/refs.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/refs.c b/src/refs.c
index 7b538659d..a15e31b53 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -377,15 +377,9 @@ static int reference__create(
return error;
if (oid != NULL) {
- git_odb *odb;
-
assert(symbolic == NULL);
- /* Sanity check the reference being created - target must exist. */
- if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
- return error;
-
- if (!git_odb_exists(odb, oid)) {
+ if (!git_object__is_valid(repo, oid, GIT_OBJ_ANY)) {
giterr_set(GITERR_REFERENCE,
"Target OID for the reference doesn't exist on the repository");
return -1;