pretty: make show_ident_date public
authorJeff King <peff@peff.net>
Fri, 2 May 2014 01:07:22 +0000 (21:07 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 May 2014 21:13:00 +0000 (14:13 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
pretty.c
diff --git a/cache.h b/cache.h
index 107ac61b68f15b1e15532c09fda9e9799f830e44..dd9e689daf12491c1a1a1edee13bb8fa41a0b56c 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1045,6 +1045,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.
index 3c43db558aee43b0ea69c23c6611dcc9fae0661f..e1e2cad36d6d2d2773f05c6e69b0013ed8d01240 100644 (file)
--- 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;