Yet another batch of post 2.45.2 updates from the 'master' front
[alt-git.git] / ident.h
blob6a79febba15feabb8418ee6441a47553e616c6ec
1 #ifndef IDENT_H
2 #define IDENT_H
4 #include "string-list.h"
6 struct ident_split {
7 const char *name_begin;
8 const char *name_end;
9 const char *mail_begin;
10 const char *mail_end;
11 const char *date_begin;
12 const char *date_end;
13 const char *tz_begin;
14 const char *tz_end;
17 #define IDENT_STRICT 1
18 #define IDENT_NO_DATE 2
19 #define IDENT_NO_NAME 4
21 enum want_ident {
22 WANT_BLANK_IDENT,
23 WANT_AUTHOR_IDENT,
24 WANT_COMMITTER_IDENT
27 const char *ident_default_name(void);
28 const char *ident_default_email(void);
30 * Prepare an ident to fall back on if the user didn't configure it.
32 void prepare_fallback_ident(const char *name, const char *email);
33 void reset_ident_date(void);
35 * Signals an success with 0, but time part of the result may be NULL
36 * if the input lacks timestamp and zone
38 int split_ident_line(struct ident_split *, const char *, int);
41 * Given a commit or tag object buffer and the commit or tag headers, replaces
42 * the idents in the headers with their canonical versions using the mailmap mechanism.
44 void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
47 * Compare split idents for equality or strict ordering. Note that we
48 * compare only the ident part of the line, ignoring any timestamp.
50 * Because there are two fields, we must choose one as the primary key; we
51 * currently arbitrarily pick the email.
53 int ident_cmp(const struct ident_split *, const struct ident_split *);
55 const char *git_author_info(int);
56 const char *git_committer_info(int);
57 const char *fmt_ident(const char *name, const char *email,
58 enum want_ident whose_ident,
59 const char *date_str, int);
60 const char *fmt_name(enum want_ident);
62 int committer_ident_sufficiently_given(void);
63 int author_ident_sufficiently_given(void);
65 struct config_context;
66 int git_ident_config(const char *, const char *, const struct config_context *,
67 void *);
69 #endif