pretty: provide human date format

Add the placeholders %ah and %ch to format author date and committer
date, like --date=human does, which provides more humanity date output.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
ZheNing Hu
2021-04-25 10:41:45 +00:00
committed by Junio C Hamano
parent 3593ebd3f5
commit b722d4560e
3 changed files with 13 additions and 0 deletions

View File

@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,
case 'I': /* date, ISO 8601 strict */
strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));
return placeholder_len;
case 'h': /* date, human */
strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));
return placeholder_len;
case 's':
strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));
return placeholder_len;