vendor/libgit2/src/signature.c in rugged-0.26.7 vs vendor/libgit2/src/signature.c in rugged-0.27.0

- old
+ new

@@ -3,12 +3,12 @@ * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#include "common.h" #include "signature.h" + #include "repository.h" #include "git2/common.h" #include "posix.h" void git_signature_free(git_signature *sig) @@ -88,10 +88,11 @@ return signature_error("Signature cannot have an empty name or email"); } p->when.time = time; p->when.offset = offset; + p->when.sign = (offset < 0) ? '-' : '+'; *sig_out = p; return 0; } @@ -111,10 +112,11 @@ signature->email = git__strdup(source->email); GITERR_CHECK_ALLOC(signature->email); signature->when.time = source->when.time; signature->when.offset = source->when.offset; + signature->when.sign = source->when.sign; *dest = signature; return 0; } @@ -135,10 +137,11 @@ signature->email = git_pool_strdup(pool, source->email); GITERR_CHECK_ALLOC(signature->email); signature->when.time = source->when.time; signature->when.offset = source->when.offset; + signature->when.sign = source->when.sign; *dest = signature; return 0; } @@ -255,10 +258,11 @@ * only store timezone if it's not overflowing; * see http://www.worldtimezone.com/faq.html */ if (hours <= 14 && mins <= 59) { sig->when.offset = (hours * 60) + mins; + sig->when.sign = tz_start[0]; if (tz_start[0] == '-') sig->when.offset = -sig->when.offset; } } } @@ -297,11 +301,11 @@ char sign; assert(buf && sig); offset = sig->when.offset; - sign = (sig->when.offset < 0) ? '-' : '+'; + sign = (sig->when.offset < 0 || sig->when.sign == '-') ? '-' : '+'; if (offset < 0) offset = -offset; hours = offset / 60; @@ -318,8 +322,9 @@ return git__strcmp(one->name, two->name) == 0 && git__strcmp(one->email, two->email) == 0 && one->when.time == two->when.time && - one->when.offset == two->when.offset; + one->when.offset == two->when.offset && + one->when.sign == two->when.sign; }