From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH] pretty: add format specifiers for short and raw date formats
Date: Wed, 7 Oct 2015 18:28:25 +0200 [thread overview]
Message-ID: <1444235305-8718-1-git-send-email-szeder@ira.uka.de> (raw)
Other date formats already have their format specifiers and so should
these, so they will be available in pretty format aliases as well.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
Documentation/pretty-formats.txt | 4 ++++
pretty.c | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index 671cebd95c..ce62c70659 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -120,6 +120,8 @@ The placeholders are:
- '%at': author date, UNIX timestamp
- '%ai': author date, ISO 8601-like format
- '%aI': author date, strict ISO 8601 format
+- '%as': author date, short format
+- '%aR': author date, raw format
- '%cn': committer name
- '%cN': committer name (respecting .mailmap, see
linkgit:git-shortlog[1] or linkgit:git-blame[1])
@@ -132,6 +134,8 @@ The placeholders are:
- '%ct': committer date, UNIX timestamp
- '%ci': committer date, ISO 8601-like format
- '%cI': committer date, strict ISO 8601 format
+- '%cs': committer date, short format
+- '%cR': committer date, raw format
- '%d': ref names, like the --decorate option of linkgit:git-log[1]
- '%D': ref names without the " (", ")" wrapping.
- '%e': encoding
diff --git a/pretty.c b/pretty.c
index 151c2ae312..e3ea2c03b0 100644
--- a/pretty.c
+++ b/pretty.c
@@ -723,6 +723,12 @@ 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 's': /* date, short */
+ strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));
+ return placeholder_len;
+ case 'R': /* date, raw */
+ strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(RAW)));
+ return placeholder_len;
}
skip:
--
2.6.1.134.ge857153
next reply other threads:[~2015-10-07 16:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 16:28 SZEDER Gábor [this message]
2015-10-07 20:22 ` [PATCH] pretty: add format specifiers for short and raw date formats Junio C Hamano
2015-10-08 11:04 ` SZEDER Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444235305-8718-1-git-send-email-szeder@ira.uka.de \
--to=szeder@ira.uka.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).