]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ident.h: move ident-related declarations out of cache.h
authorElijah Newren <newren@gmail.com>
Fri, 24 Feb 2023 00:09:29 +0000 (00:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Feb 2023 01:25:29 +0000 (17:25 -0800)
These functions were all defined in a separate ident.c already, so
create ident.h and move the declarations into that file.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
builtin/check-mailmap.c
builtin/config.c
builtin/var.c
cache.h
config.c
gpg-interface.c
ident.c
ident.h [new file with mode: 0644]
refs/files-backend.c
revision.h

index 3040016e27afa5a91b57645f8c39c8549ea29092..88c5ea8b26753bf242719883a44b46989b051518 100644 (file)
@@ -10,6 +10,7 @@
 #include "builtin.h"
 #include "diff.h"
 #include "hex.h"
+#include "ident.h"
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
index 7dc47e47932c7d2e76128e54f49fa2ea0c570d62..96db3ddb4bb0c74b8e237fdeb49fdd58f394b741 100644 (file)
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "config.h"
+#include "ident.h"
 #include "mailmap.h"
 #include "parse-options.h"
 #include "string-list.h"
index ca006e9cc15f4fede375dc843a68457e228bb2d9..49d832d40931c8a895e0381a995581dfd936b038 100644 (file)
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "color.h"
+#include "ident.h"
 #include "parse-options.h"
 #include "urlmatch.h"
 #include "quote.h"
index a80c1df86fd532bb6353b990381bfb050ac5e688..d9943be9afd73dfc46e471ecee426aed00f8da08 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include "builtin.h"
 #include "config.h"
+#include "ident.h"
 #include "refs.h"
 
 static const char var_usage[] = "git var (-l | <variable>)";
diff --git a/cache.h b/cache.h
index 0c631e75b550fc207d979c4badfb33c05798c38f..4e0d9bccc068f0701eeea7168b865b16a4e0bb2a 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1445,65 +1445,10 @@ 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)
 
-#define IDENT_STRICT          1
-#define IDENT_NO_DATE         2
-#define IDENT_NO_NAME         4
-
-enum want_ident {
-       WANT_BLANK_IDENT,
-       WANT_AUTHOR_IDENT,
-       WANT_COMMITTER_IDENT
-};
-
-const char *git_author_info(int);
-const char *git_committer_info(int);
-const char *fmt_ident(const char *name, const char *email,
-                     enum want_ident whose_ident,
-                     const char *date_str, int);
-const char *fmt_name(enum want_ident);
-const char *ident_default_name(void);
-const char *ident_default_email(void);
 const char *git_editor(void);
 const char *git_sequence_editor(void);
 const char *git_pager(int stdout_is_tty);
 int is_terminal_dumb(void);
-int git_ident_config(const char *, const char *, void *);
-/*
- * Prepare an ident to fall back on if the user didn't configure it.
- */
-void prepare_fallback_ident(const char *name, const char *email);
-void reset_ident_date(void);
-
-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
- */
-int split_ident_line(struct ident_split *, const char *, int);
-
-/*
- * Given a commit or tag object buffer and the commit or tag headers, replaces
- * the idents in the headers with their canonical versions using the mailmap mechanism.
- */
-void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
-
-/*
- * Compare split idents for equality or strict ordering. Note that we
- * compare only the ident part of the line, ignoring any timestamp.
- *
- * Because there are two fields, we must choose one as the primary key; we
- * currently arbitrarily pick the email.
- */
-int ident_cmp(const struct ident_split *, const struct ident_split *);
 
 struct cache_def {
        struct strbuf path;
@@ -1570,9 +1515,6 @@ int update_server_info(int);
 const char *get_log_output_encoding(void);
 const char *get_commit_output_encoding(void);
 
-int committer_ident_sufficiently_given(void);
-int author_ident_sufficiently_given(void);
-
 extern const char *git_commit_encoding;
 extern const char *git_log_output_encoding;
 extern const char *git_mailmap_file;
index 1d22f2325165c1d0bb40f11279013933dcd30fec..d3ab9417a4500b61f4c631cd27fca3f878bf1b32 100644 (file)
--- a/config.c
+++ b/config.c
@@ -11,6 +11,7 @@
 #include "branch.h"
 #include "config.h"
 #include "environment.h"
+#include "ident.h"
 #include "repository.h"
 #include "lockfile.h"
 #include "exec-cmd.h"
index 687236430bf21c7c64d9a13128af016cf579d3c3..bd13fc92fef21df9606e01248957826fccf81423 100644 (file)
@@ -4,6 +4,7 @@
 #include "run-command.h"
 #include "strbuf.h"
 #include "dir.h"
+#include "ident.h"
 #include "gpg-interface.h"
 #include "sigchain.h"
 #include "tempfile.h"
diff --git a/ident.c b/ident.c
index 6de76f9421d57f38c478cca68fcb97c4ede2d36c..8fad92d7007e2101d630680f4aecd9626c97d6bd 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -5,10 +5,13 @@
  *
  * Copyright (C) 2005 Linus Torvalds
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "ident.h"
 #include "config.h"
 #include "date.h"
+#include "gettext.h"
 #include "mailmap.h"
+#include "strbuf.h"
 
 static struct strbuf git_default_name = STRBUF_INIT;
 static struct strbuf git_default_email = STRBUF_INIT;
diff --git a/ident.h b/ident.h
new file mode 100644 (file)
index 0000000..96a6489
--- /dev/null
+++ b/ident.h
@@ -0,0 +1,67 @@
+#ifndef IDENT_H
+#define IDENT_H
+
+#include "string-list.h"
+
+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;
+};
+
+#define IDENT_STRICT          1
+#define IDENT_NO_DATE         2
+#define IDENT_NO_NAME         4
+
+enum want_ident {
+       WANT_BLANK_IDENT,
+       WANT_AUTHOR_IDENT,
+       WANT_COMMITTER_IDENT
+};
+
+const char *ident_default_name(void);
+const char *ident_default_email(void);
+/*
+ * Prepare an ident to fall back on if the user didn't configure it.
+ */
+void prepare_fallback_ident(const char *name, const char *email);
+void reset_ident_date(void);
+/*
+ * Signals an success with 0, but time part of the result may be NULL
+ * if the input lacks timestamp and zone
+ */
+int split_ident_line(struct ident_split *, const char *, int);
+
+/*
+ * Given a commit or tag object buffer and the commit or tag headers, replaces
+ * the idents in the headers with their canonical versions using the mailmap mechanism.
+ */
+void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
+
+/*
+ * Compare split idents for equality or strict ordering. Note that we
+ * compare only the ident part of the line, ignoring any timestamp.
+ *
+ * Because there are two fields, we must choose one as the primary key; we
+ * currently arbitrarily pick the email.
+ */
+int ident_cmp(const struct ident_split *, const struct ident_split *);
+
+const char *git_author_info(int);
+const char *git_committer_info(int);
+const char *fmt_ident(const char *name, const char *email,
+                     enum want_ident whose_ident,
+                     const char *date_str, int);
+const char *fmt_name(enum want_ident);
+
+int committer_ident_sufficiently_given(void);
+int author_ident_sufficiently_given(void);
+
+int git_ident_config(const char *, const char *, void *);
+
+#endif
index 6f257c700540063f5565202c5a69f676fcad33af..31bc5c45ee693f43358335436be74cbad31db7a9 100644 (file)
@@ -5,6 +5,7 @@
 #include "refs-internal.h"
 #include "ref-cache.h"
 #include "packed-backend.h"
+#include "../ident.h"
 #include "../iterator.h"
 #include "../dir-iterator.h"
 #include "../lockfile.h"
index 30febad09a1e3493ed9b89cd57486134cc120f14..ab71443696d527d3f4def94ba67aea1c743eb3da 100644 (file)
@@ -8,6 +8,7 @@
 #include "pretty.h"
 #include "diff.h"
 #include "commit-slab-decl.h"
+#include "ident.h"
 #include "list-objects-filter-options.h"
 
 /**