summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-03-11 09:25:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-11 10:56:50 (GMT)
commit4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d (patch)
treee27c18ce9dc5ee6976602eb04702536b6306be4c /cache.h
parent0dbe6592ccbd1a394a69a52074e3729d546fe952 (diff)
downloadgit-4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d.zip
git-4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d.tar.gz
git-4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d.tar.bz2
ident.c: add split_ident_line() to parse formatted ident line
The commit formatting logic format_person_part() in pretty.c implements the logic to split an author/committer ident line into its parts, intermixed with logic to compute its output using these piece it computes. Separate the former out to a helper function split_ident_line() so that other codepath can use the same logic, and rewrite the function using the helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 3a8e125..7c42eca 100644
--- a/cache.h
+++ b/cache.h
@@ -928,6 +928,22 @@ extern const char *fmt_name(const char *name, const char *email);
extern const char *git_editor(void);
extern const char *git_pager(int stdout_is_tty);
+struct ident_split {
+ const char *name_begin;
+ const char *name_end;
+ const char *mail_begin;
+ const char *mail_end;
+ const char *date_begin;
+ const char *date_end;
+ const char *tz_begin;
+ const char *tz_end;
+};
+/*
+ * Signals an success with 0, but time part of the result may be NULL
+ * if the input lacks timestamp and zone
+ */
+extern int split_ident_line(struct ident_split *, const char *, int);
+
struct checkout {
const char *base_dir;
int base_dir_len;