Show commit date/time in !gitlog output
- !gitlog now shows the commit date and time in [YYYY-MM-DD HH:MM:SS]
format at the beginning of each commit line, e.g.:
[2026-07-22 14:30:15] 184d4c4 Fix whitespace... - https://...
- Changed git log format from '%H %s' to '%ci %H %s' and parsed the
ISO date to extract date+time without timezone offset.
(0.40.2)
This commit is contained in:
parent
c1c9f0208b
commit
13409e78f7
2 changed files with 33 additions and 18 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
2026.07.23 - Show commit date/time in !gitlog output. (0.40.2)
|
||||||
|
|
||||||
|
- `!gitlog` now shows the commit date and time in `[YYYY-MM-DD HH:MM:SS]` format at the beginning of each commit line (e.g. `[2026-07-22 14:30:15] 184d4c4 Fix whitespace...`).
|
||||||
|
|
||||||
2026.07.23 - Fix !zynk key-value timestamps to use localtime. (0.40.1)
|
2026.07.23 - Fix !zynk key-value timestamps to use localtime. (0.40.1)
|
||||||
|
|
||||||
- Fixed `!zynk key = value` storing UTC timestamps instead of localtime: `db_set()` and the `zynk` table default used `datetime('now')` which returns UTC, causing `!zynk <key>` to display a timestamp offset by the server's timezone difference. Changed to `datetime('now','localtime')` so timestamps match the system's local time.
|
- Fixed `!zynk key = value` storing UTC timestamps instead of localtime: `db_set()` and the `zynk` table default used `datetime('now')` which returns UTC, causing `!zynk <key>` to display a timestamp offset by the server's timezone difference. Changed to `datetime('now','localtime')` so timestamps match the system's local time.
|
||||||
|
|
|
||||||
19
cmd_gitlog.h
19
cmd_gitlog.h
|
|
@ -84,7 +84,7 @@ int cmd_gitlog(Session *s, const char *msg, const char *reply_target, const char
|
||||||
if (dn >= 0) { dup2(dn, STDERR_FILENO); close(dn); }
|
if (dn >= 0) { dup2(dn, STDERR_FILENO); close(dn); }
|
||||||
char cnt[8];
|
char cnt[8];
|
||||||
snprintf(cnt, sizeof cnt, "%d", count);
|
snprintf(cnt, sizeof cnt, "%d", count);
|
||||||
execlp("git", "git", "log", "--format=%H %s", "-n", cnt, (char *)NULL);
|
execlp("git", "git", "log", "--format=%ci %H %s", "-n", cnt, (char *)NULL);
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
close(out_pipe[1]);
|
close(out_pipe[1]);
|
||||||
|
|
@ -111,17 +111,24 @@ int cmd_gitlog(Session *s, const char *msg, const char *reply_target, const char
|
||||||
char *line = strtok(buf, "\n");
|
char *line = strtok(buf, "\n");
|
||||||
while (line) {
|
while (line) {
|
||||||
while (*line == ' ') line++;
|
while (*line == ' ') line++;
|
||||||
char *sp = strchr(line, ' ');
|
if (strlen(line) > 25 && line[4] == '-' && line[7] == '-' && line[10] == ' ' &&
|
||||||
|
line[13] == ':' && line[16] == ':' && line[19] == ' ') {
|
||||||
|
char datetime[21];
|
||||||
|
memcpy(datetime, line, 19);
|
||||||
|
datetime[19] = 0;
|
||||||
|
char *rest = line + 25;
|
||||||
|
while (*rest == ' ') rest++;
|
||||||
|
char *sp = strchr(rest, ' ');
|
||||||
if (sp) {
|
if (sp) {
|
||||||
*sp = 0;
|
*sp = 0;
|
||||||
char *hash = line;
|
char *hash = rest;
|
||||||
char *msg = sp + 1;
|
char *msg = sp + 1;
|
||||||
while (*msg == ' ') msg++;
|
while (*msg == ' ') msg++;
|
||||||
char short_hash[8];
|
char short_hash[8];
|
||||||
strncpy(short_hash, hash, 7);
|
strncpy(short_hash, hash, 7);
|
||||||
short_hash[7] = 0;
|
short_hash[7] = 0;
|
||||||
char display[512];
|
char display[512];
|
||||||
snprintf(display, sizeof display, "%s %s", short_hash, msg);
|
snprintf(display, sizeof display, "[%s] %s %s", datetime, short_hash, msg);
|
||||||
collapse_spaces(display);
|
collapse_spaces(display);
|
||||||
if (*remote_url) {
|
if (*remote_url) {
|
||||||
char link[4096];
|
char link[4096];
|
||||||
|
|
@ -130,6 +137,10 @@ int cmd_gitlog(Session *s, const char *msg, const char *reply_target, const char
|
||||||
} else {
|
} else {
|
||||||
irc_msg(s, reply_target, display);
|
irc_msg(s, reply_target, display);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
collapse_spaces(rest);
|
||||||
|
if (*rest) irc_msg(s, reply_target, rest);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
collapse_spaces(line);
|
collapse_spaces(line);
|
||||||
if (*line) irc_msg(s, reply_target, line);
|
if (*line) irc_msg(s, reply_target, line);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue