Skip to content

Commit

Permalink
For log view, retains to use Date instead of AuthorDate, when opt_com…
Browse files Browse the repository at this point in the history
…mitter/opt_commit_date are no.
  • Loading branch information
PaulChanHK committed Apr 9, 2018
1 parent c7a5aed commit 9ca6bb7
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,28 @@ log_read(struct view *view, struct buffer *buf, bool force_stop)
case LINE_PP_COMMITTER:
if (opt_committer ^ (type == LINE_PP_COMMITTER))
return true;
if ((type == LINE_PP_AUTHOR) && (!opt_commit_date)) {
/* retains to use Date instead of AuthorDate,
* when opt_committer/opt_commit_date are no. */
memmove(data + 8, data + 12, strlen(data + 12) + 1);
}
break;
case LINE_PP_AUTHORDATE:
case LINE_PP_COMMITDATE:
if (opt_commit_date ^ (type == LINE_PP_COMMITDATE))
return true;
/* put AUTHORDATE after COMMITTER */
if ((type == LINE_PP_AUTHORDATE) && opt_committer && (!state->read_date_line))
{
state->read_date_line = strdup(data);
return true;
if (type == LINE_PP_AUTHORDATE) {
if (!opt_committer) {
/* retains to use Date instead of AuthorDate,
* when opt_committer/opt_commit_date are no. */
memcpy(data, "Date: ", 8);
memmove(data + 8, data + 12, strlen(data + 12) + 1);
}
/* when opt_committer is yes, put AUTHORDATE after COMMITTER */
else if (!state->read_date_line) {
state->read_date_line = strdup(data);
return true;
}
}
break;
default:
Expand Down

0 comments on commit 9ca6bb7

Please sign in to comment.