Skip to content

Commit 724d635

Browse files
dschogitster
authored andcommitted
help -a: do not list commands that are excluded from the build
When built with NO_CURL or with NO_UNIX_SOCKETS, some commands are skipped from the build. It does not make sense to list them in the output of `git help -a`, so let's just not. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b64e21 commit 724d635

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ FUZZ_PROGRAMS =
611611
LIB_OBJS =
612612
PROGRAM_OBJS =
613613
PROGRAMS =
614+
EXCLUDED_PROGRAMS =
614615
SCRIPT_PERL =
615616
SCRIPT_PYTHON =
616617
SCRIPT_SH =
@@ -1319,6 +1320,7 @@ ifdef NO_CURL
13191320
REMOTE_CURL_PRIMARY =
13201321
REMOTE_CURL_ALIASES =
13211322
REMOTE_CURL_NAMES =
1323+
EXCLUDED_PROGRAMS += git-http-fetch git-http-push
13221324
else
13231325
ifdef CURLDIR
13241326
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
@@ -1343,7 +1345,11 @@ endif
13431345
ifeq "$(curl_check)" "070908"
13441346
ifndef NO_EXPAT
13451347
PROGRAM_OBJS += http-push.o
1348+
else
1349+
EXCLUDED_PROGRAMS += git-http-push
13461350
endif
1351+
else
1352+
EXCLUDED_PROGRAMS += git-http-push
13471353
endif
13481354
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
13491355
ifeq "$(curl_check)" "072200"
@@ -1589,7 +1595,9 @@ ifdef NO_INET_PTON
15891595
LIB_OBJS += compat/inet_pton.o
15901596
BASIC_CFLAGS += -DNO_INET_PTON
15911597
endif
1592-
ifndef NO_UNIX_SOCKETS
1598+
ifdef NO_UNIX_SOCKETS
1599+
EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
1600+
else
15931601
LIB_OBJS += unix-socket.o
15941602
PROGRAM_OBJS += credential-cache.o
15951603
PROGRAM_OBJS += credential-cache--daemon.o
@@ -2108,7 +2116,9 @@ $(BUILT_INS): git$X
21082116
command-list.h: generate-cmdlist.sh command-list.txt
21092117

21102118
command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
2111-
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
2119+
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2120+
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2121+
command-list.txt >$@+ && mv $@+ $@
21122122

21132123
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
21142124
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\

generate-cmdlist.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ die () {
66
}
77

88
command_list () {
9-
grep -v '^#' "$1"
9+
eval "grep -ve '^#' $exclude_programs" <"$1"
1010
}
1111

1212
get_categories () {
@@ -93,6 +93,14 @@ EOF
9393
EOF
9494
}
9595

96+
exclude_programs=
97+
while test "--exclude-program" = "$1"
98+
do
99+
shift
100+
exclude_programs="$exclude_programs -e \"^$1 \""
101+
shift
102+
done
103+
96104
echo "/* Automatically generated by generate-cmdlist.sh */
97105
struct cmdname_help {
98106
const char *name;

0 commit comments

Comments
 (0)