summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 33e10c2)
raw | patch | inline | side by side (parent: 33e10c2)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 28 Mar 2010 15:56:32 +0000 (11:56 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 29 Mar 2010 00:18:17 +0000 (20:18 -0400) |
tig.c | patch | blob | history |
index 54d99a721378cee897c49df99e728b61357dba55..e7f1599dd0e47b56259216d49c73b42b2590040d 100644 (file)
--- a/tig.c
+++ b/tig.c
}
static const char *
-string_date(const struct time *time, enum date date)
+mkdate(const struct time *time, enum date date)
{
static char buf[DATE_COLS + 1];
static const struct enum_map reldate[] = {
};
struct tm tm;
+ if (!date || !time || !time->sec)
+ return "";
+
if (date == DATE_RELATIVE) {
struct timeval now;
time_t date = time->sec + time->tz;
#define is_initial_commit() (!get_ref_head())
#define is_head_commit(rev) (!strcmp((rev), "HEAD") || (get_ref_head() && !strcmp(rev, get_ref_head()->id)))
-#define mkdate(time) string_date(time, opt_date)
/*
@@ -2235,7 +2237,7 @@ draw_field(struct view *view, enum line_type type, const char *text, int len, bo
static bool
draw_date(struct view *view, struct time *time)
{
- const char *date = time && time->sec ? mkdate(time) : "";
+ const char *date = mkdate(time, opt_date);
int cols = opt_date == DATE_SHORT ? DATE_SHORT_COLS : DATE_COLS;
return draw_field(view, LINE_DATE, date, cols, FALSE);
const char *text[] = {
entry->name,
opt_author ? entry->author : "",
- opt_date ? mkdate(&entry->time) : "",
+ mkdate(&entry->time, opt_date),
NULL
};
commit ? commit->title : "",
commit ? commit->id : "",
commit && opt_author ? commit->author : "",
- commit && opt_date ? mkdate(&commit->time) : "",
+ commit ? mkdate(&commit->time, opt_date) : "",
NULL
};
const char *text[] = {
commit->title,
opt_author ? commit->author : "",
- opt_date ? mkdate(&commit->time) : "",
+ mkdate(&commit->time, opt_date),
NULL
};