summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archive-zip.c1
-rw-r--r--builtin/am.c1
-rw-r--r--builtin/commit.c1
-rw-r--r--builtin/fast-import.c1
-rw-r--r--builtin/show-branch.c1
-rw-r--r--builtin/tag.c1
-rw-r--r--cache.h48
-rw-r--r--config.c1
-rw-r--r--date.c1
-rw-r--r--date.h43
-rw-r--r--http-backend.c1
-rw-r--r--ident.c1
-rw-r--r--object-name.c1
-rw-r--r--pretty.h10
-rw-r--r--reflog-walk.h1
-rw-r--r--refs.c1
-rw-r--r--strbuf.c1
-rw-r--r--t/helper/test-date.c1
18 files changed, 68 insertions, 48 deletions
diff --git a/archive-zip.c b/archive-zip.c
index 2961e01..8ea9d1a 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -9,6 +9,7 @@
#include "object-store.h"
#include "userdiff.h"
#include "xdiff-interface.h"
+#include "date.h"
static int zip_date;
static int zip_time;
diff --git a/builtin/am.c b/builtin/am.c
index 7de2c89..eb24bc8 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -34,6 +34,7 @@
#include "string-list.h"
#include "packfile.h"
#include "repository.h"
+#include "pretty.h"
/**
* Returns the length of the first line of msg.
diff --git a/builtin/commit.c b/builtin/commit.c
index b9ed037..6b99ac2 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -37,6 +37,7 @@
#include "help.h"
#include "commit-reach.h"
#include "commit-graph.h"
+#include "pretty.h"
static const char * const builtin_commit_usage[] = {
N_("git commit [<options>] [--] <pathspec>..."),
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 2b2e28b..28f2b9c 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -19,6 +19,7 @@
#include "mem-pool.h"
#include "commit-reach.h"
#include "khash.h"
+#include "date.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index e12c5e8..330b055 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -8,6 +8,7 @@
#include "parse-options.h"
#include "dir.h"
#include "commit-slab.h"
+#include "date.h"
static const char* show_branch_usage[] = {
N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
diff --git a/builtin/tag.c b/builtin/tag.c
index 134b3f1..2479da0 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -20,6 +20,7 @@
#include "oid-array.h"
#include "column.h"
#include "ref-filter.h"
+#include "date.h"
static const char * const git_tag_usage[] = {
N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
diff --git a/cache.h b/cache.h
index 703a474..48e77aa 100644
--- a/cache.h
+++ b/cache.h
@@ -1559,46 +1559,6 @@ struct object *repo_peel_to_type(struct repository *r,
#define peel_to_type(name, namelen, obj, type) \
repo_peel_to_type(the_repository, name, namelen, obj, type)
-enum date_mode_type {
- DATE_NORMAL = 0,
- DATE_HUMAN,
- DATE_RELATIVE,
- DATE_SHORT,
- DATE_ISO8601,
- DATE_ISO8601_STRICT,
- DATE_RFC2822,
- DATE_STRFTIME,
- DATE_RAW,
- DATE_UNIX
-};
-
-struct date_mode {
- enum date_mode_type type;
- const char *strftime_fmt;
- int local;
-};
-
-/*
- * Convenience helper for passing a constant type, like:
- *
- * show_date(t, tz, DATE_MODE(NORMAL));
- */
-#define DATE_MODE(t) date_mode_from_type(DATE_##t)
-struct date_mode *date_mode_from_type(enum date_mode_type type);
-
-const char *show_date(timestamp_t time, int timezone, const struct date_mode *mode);
-void show_date_relative(timestamp_t time, struct strbuf *timebuf);
-int parse_date(const char *date, struct strbuf *out);
-int parse_date_basic(const char *date, timestamp_t *timestamp, int *offset);
-int parse_expiry_date(const char *date, timestamp_t *timestamp);
-void datestamp(struct strbuf *out);
-#define approxidate(s) approxidate_careful((s), NULL)
-timestamp_t approxidate_careful(const char *, int *);
-timestamp_t approxidate_relative(const char *date);
-void parse_date_format(const char *format, struct date_mode *mode);
-int date_overflows(timestamp_t date);
-time_t tm_to_time_t(const struct tm *tm);
-
#define IDENT_STRICT 1
#define IDENT_NO_DATE 2
#define IDENT_NO_NAME 4
@@ -1645,14 +1605,6 @@ struct ident_split {
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,
- const struct 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/config.c b/config.c
index e0c03d1..430868f 100644
--- a/config.c
+++ b/config.c
@@ -6,6 +6,7 @@
*
*/
#include "cache.h"
+#include "date.h"
#include "branch.h"
#include "config.h"
#include "environment.h"
diff --git a/date.c b/date.c
index 84bb445..863b07e 100644
--- a/date.c
+++ b/date.c
@@ -5,6 +5,7 @@
*/
#include "cache.h"
+#include "date.h"
/*
* This is like mktime, but without normalization of tm_wday and tm_yday.
diff --git a/date.h b/date.h
new file mode 100644
index 0000000..5db9ec8
--- /dev/null
+++ b/date.h
@@ -0,0 +1,43 @@
+#ifndef DATE_H
+#define DATE_H
+
+enum date_mode_type {
+ DATE_NORMAL = 0,
+ DATE_HUMAN,
+ DATE_RELATIVE,
+ DATE_SHORT,
+ DATE_ISO8601,
+ DATE_ISO8601_STRICT,
+ DATE_RFC2822,
+ DATE_STRFTIME,
+ DATE_RAW,
+ DATE_UNIX
+};
+
+struct date_mode {
+ enum date_mode_type type;
+ const char *strftime_fmt;
+ int local;
+};
+
+/*
+ * Convenience helper for passing a constant type, like:
+ *
+ * show_date(t, tz, DATE_MODE(NORMAL));
+ */
+#define DATE_MODE(t) date_mode_from_type(DATE_##t)
+struct date_mode *date_mode_from_type(enum date_mode_type type);
+
+const char *show_date(timestamp_t time, int timezone, const struct date_mode *mode);
+void show_date_relative(timestamp_t time, struct strbuf *timebuf);
+int parse_date(const char *date, struct strbuf *out);
+int parse_date_basic(const char *date, timestamp_t *timestamp, int *offset);
+int parse_expiry_date(const char *date, timestamp_t *timestamp);
+void datestamp(struct strbuf *out);
+#define approxidate(s) approxidate_careful((s), NULL)
+timestamp_t approxidate_careful(const char *, int *);
+timestamp_t approxidate_relative(const char *date);
+void parse_date_format(const char *format, struct date_mode *mode);
+int date_overflows(timestamp_t date);
+time_t tm_to_time_t(const struct tm *tm);
+#endif
diff --git a/http-backend.c b/http-backend.c
index 807fb88..81a7229 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -13,6 +13,7 @@
#include "packfile.h"
#include "object-store.h"
#include "protocol.h"
+#include "date.h"
static const char content_type[] = "Content-Type";
static const char content_length[] = "Content-Length";
diff --git a/ident.c b/ident.c
index 6aba4b5..89ca5b4 100644
--- a/ident.c
+++ b/ident.c
@@ -7,6 +7,7 @@
*/
#include "cache.h"
#include "config.h"
+#include "date.h"
static struct strbuf git_default_name = STRBUF_INIT;
static struct strbuf git_default_email = STRBUF_INIT;
diff --git a/object-name.c b/object-name.c
index 92862ee..060d892 100644
--- a/object-name.c
+++ b/object-name.c
@@ -15,6 +15,7 @@
#include "submodule.h"
#include "midx.h"
#include "commit-reach.h"
+#include "date.h"
static int get_oid_oneline(struct repository *r, const char *, struct object_id *, struct commit_list *);
diff --git a/pretty.h b/pretty.h
index 2f16acd..f34e24c 100644
--- a/pretty.h
+++ b/pretty.h
@@ -2,6 +2,7 @@
#define PRETTY_H
#include "cache.h"
+#include "date.h"
#include "string-list.h"
struct commit;
@@ -163,4 +164,13 @@ int format_set_trailers_options(struct process_trailer_options *opts,
const char **arg,
char **invalid_arg);
+/*
+ * 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,
+ const struct date_mode *mode);
+
+
#endif /* PRETTY_H */
diff --git a/reflog-walk.h b/reflog-walk.h
index f26408f..e9e00ff 100644
--- a/reflog-walk.h
+++ b/reflog-walk.h
@@ -5,6 +5,7 @@
struct commit;
struct reflog_walk_info;
+struct date_mode;
void init_reflog_walk(struct reflog_walk_info **info);
int add_reflog_for_walk(struct reflog_walk_info *info,
diff --git a/refs.c b/refs.c
index 7017ae5..b74f381 100644
--- a/refs.c
+++ b/refs.c
@@ -19,6 +19,7 @@
#include "strvec.h"
#include "repository.h"
#include "sigchain.h"
+#include "date.h"
/*
* List of all available backends
diff --git a/strbuf.c b/strbuf.c
index 613fee8..00abeb5 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -2,6 +2,7 @@
#include "refs.h"
#include "string-list.h"
#include "utf8.h"
+#include "date.h"
int starts_with(const char *str, const char *prefix)
{
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index 099eff4..ded3d05 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,5 +1,6 @@
#include "test-tool.h"
#include "cache.h"
+#include "date.h"
static const char *usage_msg = "\n"
" test-tool date relative [time_t]...\n"