@matheusbsbs / matheus-bagliano / commits / 4e244cbc5c
Fork 0

log --reflog: honour --relative-date

If you say "git log -g --relative-date", it is very likely that you want to see the reflog names in terms of a relative date. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Feb 8, 2007 at 21:58 UTC 4e244cbc5cc4c8a43982d4023bc0d9fb0b0c7d43
3 files changed +10 -7
log-tree.c
+2 -1
@@ -226,7 +226,8 @@ void show_log(struct rev_info *opt, const char *sep)
226 putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
227 if (opt->reflog_info) {
228 show_reflog_message(opt->reflog_info,
229 - opt->commit_format == CMIT_FMT_ONELINE);;
229 + opt->commit_format == CMIT_FMT_ONELINE,
230 + opt->relative_date);
231 if (opt->commit_format == CMIT_FMT_ONELINE) {
232 printf("%s", sep);
233 return;
reflog-walk.c
+7 -5
@@ -227,7 +227,8 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
227 commit->object.flags &= ~(ADDED | SEEN | SHOWN);
228 }
229
230 -void show_reflog_message(struct reflog_walk_info* info, int oneline)
230 +void show_reflog_message(struct reflog_walk_info* info, int oneline,
231 + int relative_date)
232 {
233 if (info && info->last_commit_reflog) {
234 struct commit_reflog *commit_reflog = info->last_commit_reflog;
@@ -236,7 +237,7 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)
237 info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
238 if (oneline) {
239 printf("%s@{", commit_reflog->reflogs->ref);
239 - if (commit_reflog->flag)
240 + if (commit_reflog->flag || relative_date)
241 printf("%s", show_date(info->timestamp, 0, 1));
242 else
243 printf("%d", commit_reflog->reflogs->nr
@@ -245,9 +246,10 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)
246 }
247 else {
248 printf("Reflog: %s@{", commit_reflog->reflogs->ref);
248 - if (commit_reflog->flag)
249 - printf("%s", show_rfc2822_date(info->timestamp,
250 - info->tz));
249 + if (commit_reflog->flag || relative_date)
250 + printf("%s", show_date(info->timestamp,
251 + info->tz,
252 + relative_date));
253 else
254 printf("%d", commit_reflog->reflogs->nr
255 - 2 - commit_reflog->recno);
reflog-walk.h
+1 -1
@@ -6,6 +6,6 @@ extern void add_reflog_for_walk(struct reflog_walk_info *info,
6 struct commit *commit, const char *name);
7 extern void fake_reflog_parent(struct reflog_walk_info *info,
8 struct commit *commit);
9 -extern void show_reflog_message(struct reflog_walk_info *info, int);
9 +extern void show_reflog_message(struct reflog_walk_info *info, int, int);
10
11 #endif