Commit 81234673 by Carlos Martín Nieto Committed by Vicent Marti

tag: discover the target type if needed

Don't blindly pass the target type to git_tag_type2string as it will
give an empty string on GIT_OBJ_ANY which would cause us to create an
invalid tag object.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent 26f2c897
......@@ -209,6 +209,14 @@ static int tag_create(
return error;
}
/* Try to find out what the type is */
if (target_type == GIT_OBJ_ANY) {
size_t _unused;
error = git_odb_read_header(&_unused, &target_type, repo->db, target);
if (error < GIT_SUCCESS)
return error;
}
type_str = git_object_type2string(target_type);
tagger_str_len = git_signature__write(&tagger_str, "tagger", tagger);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment