revert(3p/git): Revert merge of git upstream at v2.26.2

This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232, reversing
changes made to f2b211131f.
This commit is contained in:
Vincent Ambo 2020-05-26 00:06:52 +01:00
parent 6f8fbf4aa4
commit 93ba78d6f4
1006 changed files with 60537 additions and 148724 deletions

View file

@ -64,16 +64,16 @@ static time_t gm_time_t(timestamp_t time, int tz)
* thing, which means that tz -0100 is passed in as the integer -100,
* even though it means "sixty minutes off"
*/
static struct tm *time_to_tm(timestamp_t time, int tz, struct tm *tm)
static struct tm *time_to_tm(timestamp_t time, int tz)
{
time_t t = gm_time_t(time, tz);
return gmtime_r(&t, tm);
return gmtime(&t);
}
static struct tm *time_to_tm_local(timestamp_t time, struct tm *tm)
static struct tm *time_to_tm_local(timestamp_t time)
{
time_t t = time;
return localtime_r(&t, tm);
return localtime(&t);
}
/*
@ -128,17 +128,16 @@ static void get_time(struct timeval *now)
gettimeofday(now, NULL);
}
void show_date_relative(timestamp_t time, struct strbuf *timebuf)
void show_date_relative(timestamp_t time,
const struct timeval *now,
struct strbuf *timebuf)
{
struct timeval now;
timestamp_t diff;
get_time(&now);
if (now.tv_sec < time) {
if (now->tv_sec < time) {
strbuf_addstr(timebuf, _("in the future"));
return;
}
diff = now.tv_sec - time;
diff = now->tv_sec - time;
if (diff < 90) {
strbuf_addf(timebuf,
Q_("%"PRItime" second ago", "%"PRItime" seconds ago", diff), diff);
@ -241,7 +240,9 @@ static void show_date_normal(struct strbuf *buf, timestamp_t time, struct tm *tm
/* Show "today" times as just relative times */
if (hide.wday) {
show_date_relative(time, buf);
struct timeval now;
get_time(&now);
show_date_relative(time, &now, buf);
return;
}
@ -283,7 +284,6 @@ static void show_date_normal(struct strbuf *buf, timestamp_t time, struct tm *tm
const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
{
struct tm *tm;
struct tm tmbuf = { 0 };
struct tm human_tm = { 0 };
int human_tz = -1;
static struct strbuf timebuf = STRBUF_INIT;
@ -313,17 +313,20 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
}
if (mode->type == DATE_RELATIVE) {
struct timeval now;
strbuf_reset(&timebuf);
show_date_relative(time, &timebuf);
get_time(&now);
show_date_relative(time, &now, &timebuf);
return timebuf.buf;
}
if (mode->local)
tm = time_to_tm_local(time, &tmbuf);
tm = time_to_tm_local(time);
else
tm = time_to_tm(time, tz, &tmbuf);
tm = time_to_tm(time, tz);
if (!tm) {
tm = time_to_tm(0, 0, &tmbuf);
tm = time_to_tm(0, 0);
tz = 0;
}
@ -977,11 +980,10 @@ void datestamp(struct strbuf *out)
{
time_t now;
int offset;
struct tm tm = { 0 };
time(&now);
offset = tm_to_time_t(localtime_r(&now, &tm)) - now;
offset = tm_to_time_t(localtime(&now)) - now;
offset /= 60;
date_string(now, offset, out);
@ -1303,18 +1305,15 @@ static timestamp_t approxidate_str(const char *date,
return (timestamp_t)update_tm(&tm, &now, 0);
}
timestamp_t approxidate_relative(const char *date)
timestamp_t approxidate_relative(const char *date, const struct timeval *tv)
{
struct timeval tv;
timestamp_t timestamp;
int offset;
int errors = 0;
if (!parse_date_basic(date, &timestamp, &offset))
return timestamp;
get_time(&tv);
return approxidate_str(date, (const struct timeval *) &tv, &errors);
return approxidate_str(date, tv, &errors);
}
timestamp_t approxidate_careful(const char *date, int *error_ret)