]> git.ipfire.org Git - thirdparty/git.git/blame - ident.h
Git 2.45
[thirdparty/git.git] / ident.h
CommitLineData
b5fa6081
EN
1#ifndef IDENT_H
2#define IDENT_H
3
4#include "string-list.h"
5
6struct 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;
15};
16
17#define IDENT_STRICT 1
18#define IDENT_NO_DATE 2
19#define IDENT_NO_NAME 4
20
21enum want_ident {
22 WANT_BLANK_IDENT,
23 WANT_AUTHOR_IDENT,
24 WANT_COMMITTER_IDENT
25};
26
27const char *ident_default_name(void);
28const char *ident_default_email(void);
29/*
30 * Prepare an ident to fall back on if the user didn't configure it.
31 */
32void prepare_fallback_ident(const char *name, const char *email);
33void reset_ident_date(void);
34/*
35 * Signals an success with 0, but time part of the result may be NULL
36 * if the input lacks timestamp and zone
37 */
38int split_ident_line(struct ident_split *, const char *, int);
39
40/*
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.
43 */
44void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
45
46/*
47 * Compare split idents for equality or strict ordering. Note that we
48 * compare only the ident part of the line, ignoring any timestamp.
49 *
50 * Because there are two fields, we must choose one as the primary key; we
51 * currently arbitrarily pick the email.
52 */
53int ident_cmp(const struct ident_split *, const struct ident_split *);
54
55const char *git_author_info(int);
56const char *git_committer_info(int);
57const char *fmt_ident(const char *name, const char *email,
58 enum want_ident whose_ident,
59 const char *date_str, int);
60const char *fmt_name(enum want_ident);
61
62int committer_ident_sufficiently_given(void);
63int author_ident_sufficiently_given(void);
64
a4e7e317
GC
65struct config_context;
66int git_ident_config(const char *, const char *, const struct config_context *,
67 void *);
b5fa6081
EN
68
69#endif