Commit 6ac247b38128ac889bd0633a588842a6c75e28f0

Carlos Martín Nieto 2011-04-06T11:59:40

tag: don't check twice if an object exists Remove the check in git_tag_create_frombuffer as it's done by tag_create already. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>

diff --git a/src/tag.c b/src/tag.c
index bd9ddda..c18f042 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -271,7 +271,6 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
 {
 	git_tag tag;
 	int error;
-	git_object *obj;
 
 	assert(oid && buffer);
 
@@ -280,15 +279,8 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
 	if ((error = parse_tag_buffer(&tag, buffer, buffer + strlen(buffer))) < GIT_SUCCESS)
 		return error;
 
-	error = git_object_lookup(&obj, repo, &tag.target, tag.type);
-	if (error < GIT_SUCCESS)
-		goto cleanup;
-
-	error = git_tag_create_o(oid, repo, tag.tag_name, obj, tag.tagger, tag.message);
-
-	git_object_close(obj);
+	error = git_tag_create(oid, repo, tag.tag_name, &tag.target, tag.type, tag.tagger, tag.message);
 
-cleanup:
 	git_signature_free(tag.tagger);
 	free(tag.tag_name);
 	free(tag.message);