"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
tog add century
To:
gameoftrees@openbsd.org
Date:
Mon, 2 Dec 2019 10:33:37 -0700

Download raw body.

Thread
Hello,

I just noticed that tog doesn't display the century on the year, either.
This diff adds two spaces to the date column and adds the century.

This format change is to match the century change to got blame, if
anyone is interested. Perhaps I'm the only one that cringes when I see a
year without the century.

It also adds a tab after TOG_COLOR_DATE to align the 11 with the rest of
the defines in that block.

Thanks,

Tracey

-- 

Tracey Emery

diff 22694bb8ff1cf412bbdfc251e2dce27baca160b6 /home/basepr1me/Documents/got/got
blob - 06adcabb2455e258935a7f64228a26b3d4073478
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -302,7 +302,7 @@ struct tog_log_view_state {
 #define TOG_COLOR_TREE_EXECUTABLE	8
 #define TOG_COLOR_COMMIT		9
 #define TOG_COLOR_AUTHOR		10
-#define TOG_COLOR_DATE		11
+#define TOG_COLOR_DATE			11
 
 struct tog_blame_cb_args {
 	struct tog_blame_line *lines; /* one per line */
@@ -1204,7 +1204,7 @@ draw_commit(struct tog_view *view, struct got_commit_o
     struct tog_colors *colors)
 {
 	const struct got_error *err = NULL;
-	char datebuf[10]; /* YY-MM-DD + SPACE + NUL */
+	char datebuf[12]; /* YYYY-MM-DD + SPACE + NUL */
 	char *logmsg0 = NULL, *logmsg = NULL;
 	char *author = NULL;
 	wchar_t *wlogmsg = NULL, *wauthor = NULL;
@@ -1219,7 +1219,7 @@ draw_commit(struct tog_view *view, struct got_commit_o
 	committer_time = got_object_commit_get_committer_time(commit);
 	if (localtime_r(&committer_time, &tm) == NULL)
 		return got_error_from_errno("localtime_r");
-	if (strftime(datebuf, sizeof(datebuf), "%g/%m/%d ", &tm)
+	if (strftime(datebuf, sizeof(datebuf), "%G/%m/%d ", &tm)
 	    >= sizeof(datebuf))
 		return got_error(GOT_ERR_NO_SPACE);
 
@@ -1491,7 +1491,7 @@ draw_commits(struct tog_view *view, struct commit_queu
 	char *refs_str = NULL;
 	wchar_t *wline;
 	struct tog_color *tc;
-	static const size_t date_display_cols = 9;
+	static const size_t date_display_cols = 11;
 
 	entry = first;
 	ncommits = 0;