summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-20 08:51:41 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-21 05:32:31 (GMT)
commit4d12a471230625da73be464f5a20b7480a6b8ecb (patch)
tree1a9a11d53059bdae1d114b5ca1b2747a767b06a1 /reflog-walk.c
parent53645a3a62977d5efd96ca9f3654985802212a9d (diff)
downloadgit-4d12a471230625da73be464f5a20b7480a6b8ecb.zip
git-4d12a471230625da73be464f5a20b7480a6b8ecb.tar.gz
git-4d12a471230625da73be464f5a20b7480a6b8ecb.tar.bz2
Fix --walk-reflog with --pretty=oneline
Now, "git log --abbrev-commit --pretty=o --walk-reflogs HEAD" is reasonably pleasant to use. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 989a7ae..8ccbe97 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -219,21 +219,32 @@ 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)
+void show_reflog_message(struct reflog_walk_info* info, int oneline)
{
if (info && info->last_commit_reflog) {
struct commit_reflog *commit_reflog = info->last_commit_reflog;
struct reflog_info *info;
- printf("Reflog: %s@{", commit_reflog->reflogs->ref);
- info = &commit_reflog->reflogs->items[commit_reflog->recno + 1];
- if (commit_reflog->flag)
- printf("%s", show_rfc2822_date(info->timestamp,
- info->tz));
- else
- printf("%d", commit_reflog->reflogs->nr
- - 2 - commit_reflog->recno);
- printf("} (%s)\nReflog message: %s",
- info->email, info->message);
+ info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
+ if (oneline) {
+ printf("%s@{", commit_reflog->reflogs->ref);
+ if (commit_reflog->flag)
+ printf("%s", show_date(info->timestamp, 0, 1));
+ else
+ printf("%d", commit_reflog->reflogs->nr
+ - 2 - commit_reflog->recno);
+ printf("}: ");
+ }
+ else {
+ printf("Reflog: %s@{", commit_reflog->reflogs->ref);
+ if (commit_reflog->flag)
+ printf("%s", show_rfc2822_date(info->timestamp,
+ info->tz));
+ else
+ printf("%d", commit_reflog->reflogs->nr
+ - 2 - commit_reflog->recno);
+ printf("} (%s)\nReflog message: %s",
+ info->email, info->message);
+ }
}
}