Code

log --reflog: honour --relative-date
[git.git] / reflog-walk.c
index 653ec956f08141b3e15f52665cef7a260f8ed6a4..afe1577d76ebd06e323d478f616c838142fa02d0 100644 (file)
@@ -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);