Skip to content

Commit

Permalink
pretty: make show_ident_date public
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 2, 2014
1 parent 4701026 commit d105324
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pretty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d105324

Please sign in to comment.