pretty: make show_ident_date public
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>
Jeff King committed
May 1, 2014 at 21:07 UTC
d1053246554d176173893a5283dc0c0fb563ed03
2 files changed
+9
-2
cache.h
+7
@@ -1045,6 +1045,13 @@ struct ident_split {
1045
*/
1046
extern int split_ident_line(struct ident_split *, const char *, int);
1047
1048
+/*
1049
+ * Like show_date, but pull the timestamp and tz parameters from
1050
+ * the ident_split. It will also sanity-check the values and produce
1051
+ * a well-known sentinel date if they appear bogus.
1052
+ */
1053
+const char *show_ident_date(const struct ident_split *id, enum date_mode mode);
1054
+
1055
/*
1056
* Compare split idents for equality or strict ordering. Note that we
1057
* compare only the ident part of the line, ignoring any timestamp.
pretty.c
+2
-2
@@ -393,8 +393,8 @@ static void add_rfc2047(struct strbuf *sb, const char *line, size_t len,
393
strbuf_addstr(sb, "?=");
394
}
395
396
-static const char *show_ident_date(const struct ident_split *ident,
397
- enum date_mode mode)
396
+const char *show_ident_date(const struct ident_split *ident,
397
+ enum date_mode mode)
398
{
399
unsigned long date = 0;
400
long tz = 0;