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>maint
parent
53645a3a62
commit
4d12a47123
|
@ -27,6 +27,7 @@ SYNOPSIS
|
||||||
[ \--pretty | \--header ]
|
[ \--pretty | \--header ]
|
||||||
[ \--bisect ]
|
[ \--bisect ]
|
||||||
[ \--merge ]
|
[ \--merge ]
|
||||||
|
[ \--walk-reflogs ]
|
||||||
<commit>... [ \-- <paths>... ]
|
<commit>... [ \-- <paths>... ]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -203,7 +204,8 @@ this causes the output to have two extra lines of information
|
||||||
taken from the reflog. By default, 'commit@{Nth}' notation is
|
taken from the reflog. By default, 'commit@{Nth}' notation is
|
||||||
used in the output. When the starting commit is specified as
|
used in the output. When the starting commit is specified as
|
||||||
'commit@{now}', output also uses 'commit@{timestamp}' notation
|
'commit@{now}', output also uses 'commit@{timestamp}' notation
|
||||||
instead.
|
instead. Under '\--pretty=oneline', the commit message is
|
||||||
|
prefixed with this information on the same line.
|
||||||
|
|
||||||
--merge::
|
--merge::
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,8 @@ void show_log(struct rev_info *opt, const char *sep)
|
||||||
diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
|
diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
|
||||||
putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
|
putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
|
||||||
if (opt->reflog_info)
|
if (opt->reflog_info)
|
||||||
show_reflog_message(opt->reflog_info);
|
show_reflog_message(opt->reflog_info,
|
||||||
|
opt->commit_format == CMIT_FMT_ONELINE);;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -219,14 +219,24 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
|
||||||
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
|
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) {
|
if (info && info->last_commit_reflog) {
|
||||||
struct commit_reflog *commit_reflog = info->last_commit_reflog;
|
struct commit_reflog *commit_reflog = info->last_commit_reflog;
|
||||||
struct reflog_info *info;
|
struct reflog_info *info;
|
||||||
|
|
||||||
printf("Reflog: %s@{", commit_reflog->reflogs->ref);
|
|
||||||
info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
|
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)
|
if (commit_reflog->flag)
|
||||||
printf("%s", show_rfc2822_date(info->timestamp,
|
printf("%s", show_rfc2822_date(info->timestamp,
|
||||||
info->tz));
|
info->tz));
|
||||||
|
@ -237,3 +247,4 @@ void show_reflog_message(struct reflog_walk_info* info)
|
||||||
info->email, info->message);
|
info->email, info->message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@ extern void add_reflog_for_walk(struct reflog_walk_info *info,
|
||||||
struct commit *commit, const char *name);
|
struct commit *commit, const char *name);
|
||||||
extern void fake_reflog_parent(struct reflog_walk_info *info,
|
extern void fake_reflog_parent(struct reflog_walk_info *info,
|
||||||
struct commit *commit);
|
struct commit *commit);
|
||||||
extern void show_reflog_message(struct reflog_walk_info* info);
|
extern void show_reflog_message(struct reflog_walk_info *info, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue