Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZheNing Hu <adlternative@gmail.com>2021-04-25 13:41:45 +0300
committerJunio C Hamano <gitster@pobox.com>2021-04-27 10:09:32 +0300
commitb722d4560e9d566cb8c6cdccf08d649df146eb6b (patch)
tree139de3aa4d73b836143c553ee3b1c7a51684e90e /pretty.c
parent3593ebd3f502d28eb405ce502cd9fbd743afc3fe (diff)
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>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pretty.c b/pretty.c
index e5b33ba034..b1ecd039ce 100644
--- a/pretty.c
+++ b/pretty.c
@@ -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;