Commit 9dbd8627b9a09ee8f2bf24e6d6a7809f18bb6dbb

Stefan Sperling 2021-02-04T11:11:25

tolerate tag objects which lack tagger timestamp information Fixes interop with repos such as git://github.com/steveicarus/iverilog.git Found by + ok naddy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/object_parse.c b/lib/object_parse.c
index 241ea3c..16b8d2d 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -338,8 +338,14 @@ parse_commit_time(time_t *time, time_t *gmtoff, char *committer)
 		return got_error_from_errno("strdup");
 	err = parse_gmtoff(gmtoff, tzstr);
 	free(tzstr);
-	if (err)
-		return err;
+	if (err) { 
+		if (err->code != GOT_ERR_BAD_OBJ_DATA)
+			return err;
+		/* Old versions of Git omitted the timestamp. */
+		*time = 0;
+		*gmtoff = 0;
+		return NULL;
+	}
 	*space = '\0';
 
 	/* Timestamp is separated from committer name + email by space. */