docs: exclude documentation for commands that have been excluded

When building with certain build options, some commands are excluded from the build. For example, `git-credential-cache` is skipped when building with `NO_UNIX_SOCKETS`. Let's not build or package documentation for those excluded commands. This issue was pointed out rightfully when running `make check-docs` on Windows, where we do not yet have Unix sockets, and therefore the `credential-cache` command is excluded (yet its documentation was built and shipped). Note: building the documentation via `make -C Documentation` leaves the build system with no way to determine which commands have been excluded. If called thusly, we gracefully fail to exclude their documentation. Only when building the documentation via the top-level Makefile will it get excluded properly, or after building `Documentation/GIT-EXCLUDED-PROGRAMS` manually. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Apr 18, 2019 at 06:16 UTC faa7a096d87f188cb8bb2cc1c21f80c91817ce64
3 files changed +13
Documentation/.gitignore
+1
@@ -13,3 +13,4 @@ mergetools-*.txt
13 manpage-base-url.xsl
14 SubmittingPatches.txt
15 tmp-doc-diff/
16 +/GIT-EXCLUDED-PROGRAMS
Documentation/Makefile
+3
@@ -7,7 +7,10 @@ ARTICLES =
7 SP_ARTICLES =
8 OBSOLETE_HTML =
9
10 +-include GIT-EXCLUDED-PROGRAMS
11 +
12 MAN1_TXT += $(filter-out \
13 + $(patsubst %,%.txt,$(EXCLUDED_PROGRAMS)) \
14 $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
15 $(wildcard git-*.txt))
16 MAN1_TXT += git.txt
Makefile
+9
@@ -2451,6 +2451,14 @@ $(VCSSVN_LIB): $(VCSSVN_OBJS)
2451
2452 export DEFAULT_EDITOR DEFAULT_PAGER
2453
2454 +Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2455 + @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2456 + if test x"$$EXCLUDED" != \
2457 + x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2458 + echo >&2 " * new documentation flags"; \
2459 + echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2460 + fi
2461 +
2462 .PHONY: doc man man-perl html info pdf
2463 doc: man-perl
2464 $(MAKE) -C Documentation all
@@ -3030,6 +3038,7 @@ clean: profile-clean coverage-clean cocciclean
3038 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
3039 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
3040 $(MAKE) -C Documentation/ clean
3041 + $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
3042 ifndef NO_PERL
3043 $(MAKE) -C gitweb clean
3044 $(RM) -r perl/build/