From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Emily Shaffer <nasamuffin@google.com>,
Derrick Stolee <derrickstolee@github.com>,
Elijah Newren <newren@gmail.com>,
Elijah Newren <newren@gmail.com>,
Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 10/17] ident.h: move ident-related declarations out of cache.h
Date: Fri, 24 Feb 2023 00:09:29 +0000 [thread overview]
Message-ID: <de1e29132de573753d8ac183036fe5e30b09bc6a.1677197378.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1485.v2.git.1677197376.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
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>
---
builtin/cat-file.c | 1 +
builtin/check-mailmap.c | 1 +
builtin/config.c | 1 +
builtin/var.c | 1 +
cache.h | 58 -----------------------------------
config.c | 1 +
gpg-interface.c | 1 +
ident.c | 5 ++-
ident.h | 67 +++++++++++++++++++++++++++++++++++++++++
refs/files-backend.c | 1 +
revision.h | 1 +
11 files changed, 79 insertions(+), 59 deletions(-)
create mode 100644 ident.h
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 3040016e27a..88c5ea8b267 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -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"
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 7dc47e47932..96db3ddb4bb 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "ident.h"
#include "mailmap.h"
#include "parse-options.h"
#include "string-list.h"
diff --git a/builtin/config.c b/builtin/config.c
index ca006e9cc15..49d832d4093 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -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"
diff --git a/builtin/var.c b/builtin/var.c
index a80c1df86fd..d9943be9afd 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -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 0c631e75b55..4e0d9bccc06 100644
--- 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;
diff --git a/config.c b/config.c
index 1d22f232516..d3ab9417a45 100644
--- 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"
diff --git a/gpg-interface.c b/gpg-interface.c
index 687236430bf..bd13fc92fef 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -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 6de76f9421d..8fad92d7007 100644
--- 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
index 00000000000..96a64896a01
--- /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
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 6f257c70054..31bc5c45ee6 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -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"
diff --git a/revision.h b/revision.h
index 30febad09a1..ab71443696d 100644
--- a/revision.h
+++ b/revision.h
@@ -8,6 +8,7 @@
#include "pretty.h"
#include "diff.h"
#include "commit-slab-decl.h"
+#include "ident.h"
#include "list-objects-filter-options.h"
/**
--
gitgitgadget
next prev parent reply other threads:[~2023-02-24 0:10 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 8:05 [PATCH 00/16] Header cleanups Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 01/16] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-23 13:52 ` Derrick Stolee
2023-02-23 18:13 ` Elijah Newren
2023-02-23 19:35 ` Junio C Hamano
2023-02-23 19:53 ` Elijah Newren
2023-02-23 22:07 ` Junio C Hamano
2023-02-23 23:41 ` Elijah Newren
2023-02-23 8:05 ` [PATCH 03/16] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 04/16] treewide: remove unnecessary cache.h includes in source files Elijah Newren via GitGitGadget
2023-02-23 13:57 ` Derrick Stolee
2023-02-23 8:05 ` [PATCH 05/16] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:06 ` Derrick Stolee
2023-02-23 18:22 ` Elijah Newren
2023-02-23 19:40 ` Junio C Hamano
2023-02-23 19:39 ` Junio C Hamano
2023-02-23 8:05 ` [PATCH 06/16] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-23 14:08 ` Derrick Stolee
2023-02-23 18:25 ` Elijah Newren
2023-02-24 23:55 ` Jonathan Tan
2023-02-23 8:05 ` [PATCH 07/16] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-23 14:11 ` Derrick Stolee
2023-02-23 19:31 ` Elijah Newren
2023-02-23 8:05 ` [PATCH 08/16] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 09/16] ident.h: move ident-related declarations out of cache.h Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 10/16] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-23 14:17 ` Derrick Stolee
2023-02-23 19:55 ` Elijah Newren
2023-02-23 8:05 ` [PATCH 11/16] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 12/16] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:20 ` Derrick Stolee
2023-02-23 19:55 ` Elijah Newren
2023-02-23 8:05 ` [PATCH 13/16] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 14/16] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 15/16] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-23 8:05 ` [PATCH 16/16] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-23 14:27 ` [PATCH 00/16] Header cleanups Derrick Stolee
2023-02-24 0:09 ` [PATCH v2 00/17] " Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 01/17] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 02/17] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 03/17] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 04/17] treewide: remove unnecessary cache.h includes in source files Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 05/17] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 06/17] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 07/17] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 08/17] cache.h: remove dependence on hex.h; make other files include it explicitly Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 09/17] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` Elijah Newren via GitGitGadget [this message]
2023-02-24 0:09 ` [PATCH v2 11/17] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 12/17] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 13/17] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 14/17] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 15/17] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 16/17] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-24 0:09 ` [PATCH v2 17/17] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-24 14:03 ` [PATCH v2 00/17] Header cleanups Johannes Schindelin
2023-02-25 0:10 ` Jonathan Tan
2023-02-25 0:57 ` Elijah Newren
2023-02-27 13:51 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=de1e29132de573753d8ac183036fe5e30b09bc6a.1677197378.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=nasamuffin@google.com \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).