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

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: tog add century
To:
Stuart Henderson <stu@spacehopper.org>, gameoftrees@openbsd.org
Date:
Tue, 3 Dec 2019 09:08:08 -0700

Download raw body.

Thread
On Tue, Dec 03, 2019 at 08:32:49AM -0700, Tracey Emery wrote:
> > 
> > Here's a trivial patch to do this. Would anyone be opposed to it?
> 
> Looks fine to me. Regress test would have to be altered again.
> 
> > 

Here's a diff to address all of it, if approved.

-- 

Tracey Emery

diff 22694bb8ff1cf412bbdfc251e2dce27baca160b6 /home/basepr1me/Documents/got/got
blob - 756eaa2ea3216dabe5aaf7080a2c652fdbfd0f74
file + got/got.c
--- got/got.c
+++ got/got.c
@@ -2461,7 +2461,7 @@ struct blame_line {
 	int annotated;
 	char *id_str;
 	char *committer;
-	char datebuf[11]; /* YYYY-MM-DD + NUL */
+	char datebuf[9]; /* YYYYMMDD + NUL */
 };
 
 struct blame_cb_args {
@@ -2518,7 +2518,7 @@ blame_cb(void *arg, int nlines, int lineno, struct got
 	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(bline->datebuf, sizeof(bline->datebuf), "%G/%m/%d",
+	if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G%m%d",
 	    &tm) >= sizeof(bline->datebuf)) {
 		err = got_error(GOT_ERR_NO_SPACE);
 		goto done;
blob - 8f4e9a17dc61b16779b081d5713cbb26d0e6bcd9
file + regress/cmdline/blame.sh
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
@@ -65,7 +65,7 @@ function test_blame_basic {
 	local short_commit2=`trim_obj_id 32 $commit2`
 	local short_commit3=`trim_obj_id 32 $commit3`
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
@@ -113,7 +113,7 @@ function test_blame_tag {
 	local short_commit1=`trim_obj_id 32 $commit1`
 	local short_commit2=`trim_obj_id 32 $commit2`
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 
@@ -149,7 +149,7 @@ function test_blame_file_single_line {
 
 	local short_commit1=`trim_obj_id 32 $commit1`
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -184,7 +184,7 @@ function test_blame_file_single_line_no_newline {
 
 	local short_commit1=`trim_obj_id 32 $commit1`
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -213,7 +213,7 @@ function test_blame_all_lines_replaced {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit1 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit1 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
@@ -265,7 +265,7 @@ function test_blame_lines_shifted_up {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit1 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 foo" >> $testroot/stdout.expected
@@ -321,7 +321,7 @@ function test_blame_lines_shifted_down {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -r $author_time +"%G/%m/%d"`
+	d=`date -r $author_time +"%G%m%d"`
 	echo "01) $short_commit1 $d $GOT_AUTHOR_8 1" \
 		> $testroot/stdout.expected
 	echo "02) $short_commit1 $d $GOT_AUTHOR_8 2" \
@@ -394,7 +394,7 @@ EOF
 	local commit1=`git_show_head $testroot/repo`
 	local short_commit1=`trim_obj_id 32 $commit1`
 	local author_time1=`git_show_author_time $testroot/repo`
-	local d1=`date -r $author_time1 +"%G/%m/%d"`
+	local d1=`date -r $author_time1 +"%G%m%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules codedocs docs
@@ -421,7 +421,7 @@ EOF
 	local commit2=`git_show_head $testroot/repo`
 	local short_commit2=`trim_obj_id 32 $commit2`
 	local author_time2=`git_show_author_time $testroot/repo`
-	local d2=`date -r $author_time2 +"%G/%m/%d"`
+	local d2=`date -r $author_time2 +"%G%m%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules pdns codedocs docs
@@ -445,7 +445,7 @@ EOF
 	local commit3=`git_show_head $testroot/repo`
 	local short_commit3=`trim_obj_id 32 $commit3`
 	local author_time3=`git_show_author_time $testroot/repo`
-	local d3=`date -r $author_time3 +"%G/%m/%d"`
+	local d3=`date -r $author_time3 +"%G%m%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules pdns codedocs docs
@@ -469,7 +469,7 @@ EOF
 	local commit4=`git_show_head $testroot/repo`
 	local short_commit4=`trim_obj_id 32 $commit4`
 	local author_time4=`git_show_author_time $testroot/repo`
-	local d4=`date -r $author_time4 +"%G/%m/%d"`
+	local d4=`date -r $author_time4 +"%G%m%d"`
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
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[10]; /* YYYYMMDD + 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);