summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-02-08 20:58:33 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-02-09 00:20:52 (GMT)
commit4e244cbc5cc4c8a43982d4023bc0d9fb0b0c7d43 (patch)
treef759e8aafb4210b954147f24d52d95540454ec7e /reflog-walk.c
parentb4dd485696d9fb754b0a44649ef4796883d3b903 (diff)
downloadgit-4e244cbc5cc4c8a43982d4023bc0d9fb0b0c7d43.zip
git-4e244cbc5cc4c8a43982d4023bc0d9fb0b0c7d43.tar.gz
git-4e244cbc5cc4c8a43982d4023bc0d9fb0b0c7d43.tar.bz2
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>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 653ec95..afe1577 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -227,7 +227,8 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
}
-void show_reflog_message(struct reflog_walk_info* info, int oneline)
+void show_reflog_message(struct reflog_walk_info* info, int oneline,
+ int relative_date)
{
if (info && info->last_commit_reflog) {
struct commit_reflog *commit_reflog = info->last_commit_reflog;
@@ -236,7 +237,7 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)
info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
if (oneline) {
printf("%s@{", commit_reflog->reflogs->ref);
- if (commit_reflog->flag)
+ if (commit_reflog->flag || relative_date)
printf("%s", show_date(info->timestamp, 0, 1));
else
printf("%d", commit_reflog->reflogs->nr
@@ -245,9 +246,10 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)
}
else {
printf("Reflog: %s@{", commit_reflog->reflogs->ref);
- if (commit_reflog->flag)
- printf("%s", show_rfc2822_date(info->timestamp,
- info->tz));
+ if (commit_reflog->flag || relative_date)
+ printf("%s", show_date(info->timestamp,
+ info->tz,
+ relative_date));
else
printf("%d", commit_reflog->reflogs->nr
- 2 - commit_reflog->recno);