mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-11 01:20:04 +00:00
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>
This commit is contained in:
parent
26f2c897b8
commit
81234673a1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user