@@ -1086,8 +1086,10 @@ BUILTIN_OBJS += builtin/commit-tree.o
BUILTIN_OBJS += builtin/commit.o
BUILTIN_OBJS += builtin/config.o
BUILTIN_OBJS += builtin/count-objects.o
+ifndef NO_UNIX_SOCKETS
BUILTIN_OBJS += builtin/credential-cache--daemon.o
BUILTIN_OBJS += builtin/credential-cache.o
+endif
BUILTIN_OBJS += builtin/credential-store.o
BUILTIN_OBJS += builtin/credential.o
BUILTIN_OBJS += builtin/describe.o
@@ -1693,6 +1695,7 @@ ifdef NO_INET_PTON
endif
ifdef NO_UNIX_SOCKETS
BASIC_CFLAGS += -DNO_UNIX_SOCKETS
+ EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
else
LIB_OBJS += unix-socket.o
LIB_OBJS += unix-stream-server.o
@@ -140,8 +140,10 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix);
int cmd_config(int argc, const char **argv, const char *prefix);
int cmd_count_objects(int argc, const char **argv, const char *prefix);
int cmd_credential(int argc, const char **argv, const char *prefix);
+#ifndef NO_UNIX_SOCKETS
int cmd_credential_cache(int argc, const char **argv, const char *prefix);
int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix);
+#endif
int cmd_credential_store(int argc, const char **argv, const char *prefix);
int cmd_describe(int argc, const char **argv, const char *prefix);
int cmd_diff_files(int argc, const char **argv, const char *prefix);
@@ -1,8 +1,5 @@
#include "builtin.h"
#include "parse-options.h"
-
-#ifndef NO_UNIX_SOCKETS
-
#include "config.h"
#include "tempfile.h"
#include "credential.h"
@@ -299,21 +296,3 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
return 0;
}
-
-#else
-
-int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
-{
- const char * const usage[] = {
- "git credential-cache--daemon [options] <action>",
- "",
- "credential-cache--daemon is disabled in this build of Git",
- NULL
- };
- struct option options[] = { OPT_END() };
-
- argc = parse_options(argc, argv, prefix, options, usage, 0);
- die(_("credential-cache--daemon unavailable; no unix socket support"));
-}
-
-#endif /* NO_UNIX_SOCKET */
@@ -1,8 +1,5 @@
#include "builtin.h"
#include "parse-options.h"
-
-#ifndef NO_UNIX_SOCKETS
-
#include "credential.h"
#include "string-list.h"
#include "unix-socket.h"
@@ -137,21 +134,3 @@ int cmd_credential_cache(int argc, const char **argv, const char *prefix)
return 0;
}
-
-#else
-
-int cmd_credential_cache(int argc, const char **argv, const char *prefix)
-{
- const char * const usage[] = {
- "git credential-cache [options] <action>",
- "",
- "credential-cache is disabled in this build of Git",
- NULL
- };
- struct option options[] = { OPT_END() };
-
- argc = parse_options(argc, argv, prefix, options, usage, 0);
- die(_("credential-cache unavailable; no unix socket support"));
-}
-
-#endif /* NO_UNIX_SOCKETS */
@@ -513,8 +513,10 @@ static struct cmd_struct commands[] = {
{ "config", cmd_config, RUN_SETUP_GENTLY | DELAY_PAGER_CONFIG },
{ "count-objects", cmd_count_objects, RUN_SETUP },
{ "credential", cmd_credential, RUN_SETUP_GENTLY | NO_PARSEOPT },
+#ifndef NO_UNIX_SOCKETS
{ "credential-cache", cmd_credential_cache },
{ "credential-cache--daemon", cmd_credential_cache_daemon },
+#endif
{ "credential-store", cmd_credential_store },
{ "describe", cmd_describe, RUN_SETUP },
{ "diff", cmd_diff, NO_PARSEOPT },
Change the implementation of b5dd96b70ac (make credential helpers builtins, 2020-08-13) to not build these at all under NO_UNIX_SOCKETS. This is the easiest way to get rid of one out of two users of an obscure parse_options() API I'm trying to get rid of. It does mean that the goal of emitting a custom error message in b5dd96b70ac is being eliminated, but per [1] that seems to be an OK direction to go in. By not compiling it at all it won't be included in the "struct cmd_struct", and therefore will also be omitted from "--list-cmds=builtins". 1. https://lore.kernel.org/git/cover-v2-0.6-00000000000-20210910T153146Z-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- Makefile | 3 +++ builtin.h | 2 ++ builtin/credential-cache--daemon.c | 21 --------------------- builtin/credential-cache.c | 21 --------------------- git.c | 2 ++ 5 files changed, 7 insertions(+), 42 deletions(-)