ref: efcb01ff88fa0effa948673c710ee5ce9de308de
parent: 82afe46e443db33c64684b505a967e9eadd3fbe9
author: Noam Preil <noam@pixelhero.dev>
date: Tue Nov 21 06:30:52 EST 2023
git: utilize time zone info when present and ignore it when it's not This fixes a bug which prevents us from modifying some real-world repositories (test case: KnightOS), and utilizes time zone information when it's present to improve our timestamps.
--- a/sys/src/cmd/git/pack.c
+++ b/sys/src/cmd/git/pack.c
@@ -825,6 +825,7 @@
{char buf[128];
Resub m[4];
+ vlong tz;
char *p;
int n, nm;
@@ -845,10 +846,16 @@
memcpy(*name, m[1].sp, nm);
buf[nm] = 0;
+ nm = m[3].ep - m[3].sp;
+ memcpy(buf, m[3].sp, nm);
+ buf[nm] = 0;
+ tz = atoll(buf);
+
nm = m[2].ep - m[2].sp;
memcpy(buf, m[2].sp, nm);
buf[nm] = 0;
- *time = atoll(buf);
+ *time = atoll(buf) + 3600*(tz/100) + 60*(tz%100);
+
return 0;
}
--- a/sys/src/cmd/git/util.c
+++ b/sys/src/cmd/git/util.c
@@ -207,7 +207,7 @@
fmtinstall('Q', Qfmt);inflateinit();
deflateinit();
- authorpat = regcomp("[\t ]*(.*)[\t ]+([0-9]+)[\t ]+([\\-+]?[0-9]+)");+ authorpat = regcomp("[\t ]*(.*)[\t ]+([0-9]+)[\t ]*([\\-+]?[0-9]+)?");osinit(&objcache);
}
--
⑨