From ad628fc6a4f92f34cd47520b9103541075266fc8 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sat, 15 Jul 2017 12:07:04 -0400 Subject: [PATCH] Fix #522: Increase size of the internal date buffer --- NEWS.adoc | 1 + src/util.c | 2 +- test/main/date-test | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 7b5114273..9197a4c2f 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -55,6 +55,7 @@ Bug fixes: - Fix reading from stdin for `tig show`. - Document problem of outdated system-wide `tigrc` files in Homebrew. (GH #598) - Repaint the display when toggling `line-graphics`. (GH #527) + - Fix custom date formatting support longer strings. (GH #522) tig-2.2.2 --------- diff --git a/src/util.c b/src/util.c index 728488690..7f4f19e6f 100644 --- a/src/util.c +++ b/src/util.c @@ -180,7 +180,7 @@ get_relative_date(const struct time *time, char *buf, size_t buflen, bool compac const char * mkdate(const struct time *time, enum date date, bool local, const char *custom_format) { - static char buf[STRING_SIZE("2006-04-29 14:21") + 1]; + static char buf[SIZEOF_STR]; struct tm tm; const char *format; diff --git a/test/main/date-test b/test/main/date-test index f7ceae219..d7cdfde5b 100755 --- a/test/main/date-test +++ b/test/main/date-test @@ -28,6 +28,11 @@ steps ' :toggle date :save-display no-date.screen + + :set main-view-date = custom + :set main-view-date-local = true + :set main-view-date-format = "%F %R %Z" + :save-display custom-date.screen ' test_tig --pretty=raw < "$source_dir/$test.in" @@ -205,3 +210,32 @@ Jonas Fonseca Only split the tree view when the tree view is visible Jonas Fonseca Initial commit [main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25 100% EOF + +assert_equals 'custom-date.screen' <