Commit d483a911 by Vicent Marti

signature: Fix optional header

parent 27df4275
......@@ -125,8 +125,8 @@ int git_commit_create(
git_odb_stream *stream;
message_length = strlen(message);
author_length = git_signature__write(&author_str, "author", author);
committer_length = git_signature__write(&committer_str, "committer", committer);
author_length = git_signature__write(&author_str, "author ", author);
committer_length = git_signature__write(&committer_str, "committer ", committer);
if (author_length < 0 || committer_length < 0)
return git__throw(GIT_EINVALIDARGS, "Cannot create commit. Failed to parse signature");
......
......@@ -330,15 +330,9 @@ int git_signature__write(char **signature, const char *header, const git_signatu
hours = offset / 60;
mins = offset % 60;
if (header)
sig_buffer_len = snprintf(sig_buffer, sizeof(sig_buffer),
"%s %s <%s> %u %c%02d%02d\n",
header, sig->name, sig->email,
(unsigned)sig->when.time, sign, hours, mins);
else
sig_buffer_len = snprintf(sig_buffer, sizeof(sig_buffer),
"%s <%s> %u %c%02d%02d\n",
sig->name, sig->email,
"%s%s <%s> %u %c%02d%02d\n",
header ? header : "", sig->name, sig->email,
(unsigned)sig->when.time, sign, hours, mins);
if (sig_buffer_len < 0 || (size_t)sig_buffer_len > sizeof(sig_buffer))
......
......@@ -227,7 +227,7 @@ int git_tag_create(
}
type_str = git_object_type2string(git_object_type(target));
tagger_str_len = git_signature__write(&tagger_str, "tagger", tagger);
tagger_str_len = git_signature__write(&tagger_str, "tagger ", tagger);
type_str_len = strlen(type_str);
tag_name_len = strlen(tag_name);
......
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