git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/4] pretty: make show_ident_date public
Date: Thu, 1 May 2014 21:07:22 -0400	[thread overview]
Message-ID: <20140502010722.GB25413@sigill.intra.peff.net> (raw)
In-Reply-To: <20140502010328.GA30556@sigill.intra.peff.net>

We use this function internally to format "Date" lines in
commit logs, but other parts of the code will want it, too.

Signed-off-by: Jeff King <peff@peff.net>
---
 cache.h  | 7 +++++++
 pretty.c | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/cache.h b/cache.h
index 107ac61..dd9e689 100644
--- a/cache.h
+++ b/cache.h
@@ -1046,6 +1046,13 @@ struct ident_split {
 extern int split_ident_line(struct ident_split *, const char *, int);
 
 /*
+ * Like show_date, but pull the timestamp and tz parameters from
+ * the ident_split. It will also sanity-check the values and produce
+ * a well-known sentinel date if they appear bogus.
+ */
+const char *show_ident_date(const struct ident_split *id, enum date_mode mode);
+
+/*
  * Compare split idents for equality or strict ordering. Note that we
  * compare only the ident part of the line, ignoring any timestamp.
  *
diff --git a/pretty.c b/pretty.c
index 3c43db5..e1e2cad 100644
--- a/pretty.c
+++ b/pretty.c
@@ -393,8 +393,8 @@ static void add_rfc2047(struct strbuf *sb, const char *line, size_t len,
 	strbuf_addstr(sb, "?=");
 }
 
-static const char *show_ident_date(const struct ident_split *ident,
-				   enum date_mode mode)
+const char *show_ident_date(const struct ident_split *ident,
+			    enum date_mode mode)
 {
 	unsigned long date = 0;
 	long tz = 0;
-- 
1.9.1.656.ge8a0637

  parent reply	other threads:[~2014-05-02  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 21:09 [RFD] use approxidate for "git commit --date=xyz"? Linus Torvalds
2014-04-30 21:34 ` Junio C Hamano
2014-05-01 22:06   ` Jeff King
2014-05-02  1:03     ` [PATCH 0/4] approxidate for "git commit --date=foo" Jeff King
2014-05-02  1:06       ` [PATCH 1/4] commit: use split_ident_line to compare author/committer Jeff King
2014-05-02  1:07       ` Jeff King [this message]
2014-05-02  1:10       ` [PATCH 3/4] commit: print "Date" line when the user has set date Jeff King
2014-05-02  1:12       ` [PATCH 4/4] commit: accept more date formats for "--date" Jeff King
2014-05-07  7:22   ` [RFD] use approxidate for "git commit --date=xyz"? Peter Krefting

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=20140502010722.GB25413@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=torvalds@linux-foundation.org \
    /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).