{"thread":{"id":"6741","subject":"[PATCH] log --reflog: honour --relative-date","startedAt":"2007-02-08T20:58:33Z","lastAt":"2007-02-08T20:58:33Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"33972","messageId":"Pine.LNX.4.63.0702082156370.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6741","inReplyTo":null,"subject":"[PATCH] log --reflog: honour --relative-date","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-08T20:58:33Z","receivedAt":"2007-02-08T20:58:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIf you say \"git log -g --relative-date\", it is very likely that\nyou want to see the reflog names in terms of a relative date.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n log-tree.c    |    3 ++-\n reflog-walk.c |   12 +++++++-----\n reflog-walk.h |    2 +-\n 3 files changed, 10 insertions(+), 7 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 85acd66..4e3c7fd 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -226,7 +226,8 @@ void show_log(struct rev_info *opt, const char *sep)\n \t\tputchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\\n');\n \t\tif (opt->reflog_info) {\n \t\t\tshow_reflog_message(opt->reflog_info,\n-\t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE);;\n+\t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE,\n+\t\t\t\t    opt->relative_date);\n \t\t\tif (opt->commit_format == CMIT_FMT_ONELINE) {\n \t\t\t\tprintf(\"%s\", sep);\n \t\t\t\treturn;\ndiff --git a/reflog-walk.c b/reflog-walk.c\nindex 653ec95..afe1577 100644\n--- a/reflog-walk.c\n+++ b/reflog-walk.c\n@@ -227,7 +227,8 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)\n \tcommit->object.flags &= ~(ADDED | SEEN | SHOWN);\n }\n \n-void show_reflog_message(struct reflog_walk_info* info, int oneline)\n+void show_reflog_message(struct reflog_walk_info* info, int oneline,\n+\tint relative_date)\n {\n \tif (info && info->last_commit_reflog) {\n \t\tstruct commit_reflog *commit_reflog = info->last_commit_reflog;\n@@ -236,7 +237,7 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)\n \t\tinfo = &commit_reflog->reflogs->items[commit_reflog->recno+1];\n \t\tif (oneline) {\n \t\t\tprintf(\"%s@{\", commit_reflog->reflogs->ref);\n-\t\t\tif (commit_reflog->flag)\n+\t\t\tif (commit_reflog->flag || relative_date)\n \t\t\t\tprintf(\"%s\", show_date(info->timestamp, 0, 1));\n \t\t\telse\n \t\t\t\tprintf(\"%d\", commit_reflog->reflogs->nr\n@@ -245,9 +246,10 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)\n \t\t}\n \t\telse {\n \t\t\tprintf(\"Reflog: %s@{\", commit_reflog->reflogs->ref);\n-\t\t\tif (commit_reflog->flag)\n-\t\t\t\tprintf(\"%s\", show_rfc2822_date(info->timestamp,\n-\t\t\t\t\t\t\t       info->tz));\n+\t\t\tif (commit_reflog->flag || relative_date)\n+\t\t\t\tprintf(\"%s\", show_date(info->timestamp,\n+\t\t\t\t\t\t\tinfo->tz,\n+\t\t\t\t\t\t\trelative_date));\n \t\t\telse\n \t\t\t\tprintf(\"%d\", commit_reflog->reflogs->nr\n \t\t\t\t       - 2 - commit_reflog->recno);\ndiff --git a/reflog-walk.h b/reflog-walk.h\nindex e63d867..a4f7015 100644\n--- a/reflog-walk.h\n+++ b/reflog-walk.h\n@@ -6,6 +6,6 @@ extern void add_reflog_for_walk(struct reflog_walk_info *info,\n \t\tstruct commit *commit, const char *name);\n extern void fake_reflog_parent(struct reflog_walk_info *info,\n \t\tstruct commit *commit);\n-extern void show_reflog_message(struct reflog_walk_info *info, int);\n+extern void show_reflog_message(struct reflog_walk_info *info, int, int);\n \n #endif\n"}]}