Commit 9d9fff3c3dbc207a8a2ee2114eab19086afecb6e

Scott J. Goldman 2013-06-02T02:16:05

Merge pull request #1631 from scottjg/fix-timezone-parsing Don't bail on parsing commits with an invalid timezone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/signature.c b/src/signature.c
index 1131fb7..cd6167f 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -174,8 +174,10 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
 			tz_start = time_end + 1;
 
 			if ((tz_start[0] != '-' && tz_start[0] != '+') ||
-				git__strtol32(&offset, tz_start + 1, &tz_end, 10) < 0)
-				return signature_error("malformed timezone");
+				git__strtol32(&offset, tz_start + 1, &tz_end, 10) < 0) {
+				//malformed timezone, just assume it's zero
+				offset = 0;
+			}
 
 			hours = offset / 100;
 			mins = offset % 100;