summaryrefslogtreecommitdiffstats
path: root/builtin/check-mailmap.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2024-08-27 23:27:17 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-27 23:51:29 +0200
commitf54ca6ae72e32e34f2042a93f92949e3ded11a36 (patch)
treef8bcbd406414e655ac5b69ce2652efaaf1f3f31e /builtin/check-mailmap.c
parentcheck-mailmap: accept "user@host" contacts (diff)
downloadgit-f54ca6ae72e32e34f2042a93f92949e3ded11a36.tar.xz
git-f54ca6ae72e32e34f2042a93f92949e3ded11a36.zip
check-mailmap: add options for additional mailmap sources
The git check-mailmap command reads the mailmap from either the default .mailmap location and then from the mailmap.blob and mailmap.file configurations. A following change to git send-email will want to support new configuration options based on the configured identity. The identity-based configuration and options only make sense in the context of git send-email. Expose the read_mailmap_file and read_mailmap_blob functions from mailmap.c. Teach git check-mailmap the --mailmap-file and --mailmap-blob options which load the additional mailmap sources. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/check-mailmap.c')
-rw-r--r--builtin/check-mailmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 6b7fb53494..2334b57222 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -9,6 +9,7 @@
#include "write-or-die.h"
static int use_stdin;
+static const char *mailmap_file, *mailmap_blob;
static const char * const check_mailmap_usage[] = {
N_("git check-mailmap [<options>] <contact>..."),
NULL
@@ -16,6 +17,8 @@ NULL
static const struct option check_mailmap_options[] = {
OPT_BOOL(0, "stdin", &use_stdin, N_("also read contacts from stdin")),
+ OPT_FILENAME(0, "mailmap-file", &mailmap_file, N_("read additional mailmap entries from file")),
+ OPT_STRING(0, "mailmap-blob", &mailmap_blob, N_("blob"), N_("read additional mailmap entries from blob")),
OPT_END()
};
@@ -56,6 +59,10 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix)
die(_("no contacts specified"));
read_mailmap(&mailmap);
+ if (mailmap_blob)
+ read_mailmap_blob(&mailmap, mailmap_blob);
+ if (mailmap_file)
+ read_mailmap_file(&mailmap, mailmap_file, 0);
for (i = 0; i < argc; ++i)
check_mailmap(&mailmap, argv[i]);