check-docs: get documented command list from Makefile
authorJeff King <peff@peff.net>
Wed, 8 Aug 2012 20:57:52 +0000 (16:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Aug 2012 21:32:17 +0000 (14:32 -0700)
The current code tries to get a list of documented commands
by doing "ls Documentation/git*txt" and culling a bunch of
special cases from the result. Looking for "git-*.txt" would
be more accurate, but would miss a few commands like
"gitweb" and "gitk".

Fortunately, Documentation/Makefile already knows what this
list is, so we can just ask it. Annoyingly, we still have to
post-process its output a little, since make will print
extra cruft like "GIT-VERSION-FILE is up to date" to stdout.

Now that our list is accurate, we can remove all of the ugly
special-cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/Makefile
Makefile

index 063fa696c9eff617e4fc6ad37f0b6e49d32d58f9..cf5916fe8b79e39eb57f97b36e82697694f41d7a 100644 (file)
@@ -344,4 +344,7 @@ require-htmlrepo::
 quick-install-html: require-htmlrepo
        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
 
+print-man1:
+       @for i in $(MAN1_TXT); do echo $$i; done
+
 .PHONY: FORCE
index b9da51176b5ae361a68a59e0ed31a82e7757d867..51b3c6fc9c1e4f0382fa9841836664dec1e7a6a3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2832,34 +2832,12 @@ check-docs::
                sed -e '/^#/d' \
                    -e 's/[     ].*//' \
                    -e 's/^/listed /' command-list.txt; \
-               ls -1 Documentation/git*txt | \
+               $(MAKE) -C Documentation print-man1 | \
+               grep '\.txt$$' | \
                sed -e 's|Documentation/|documented |' \
                    -e 's/\.txt//'; \
        ) | while read how cmd; \
        do \
-               case "$$how,$$cmd" in \
-               documented,gitattributes | \
-               documented,gitignore | \
-               documented,gitmodules | \
-               documented,gitcli | \
-               documented,git-tools | \
-               documented,gitcore-tutorial | \
-               documented,gitcvs-migration | \
-               documented,gitdiffcore | \
-               documented,gitglossary | \
-               documented,githooks | \
-               documented,gitrepository-layout | \
-               documented,gitrevisions | \
-               documented,gittutorial | \
-               documented,gittutorial-2 | \
-               documented,git-bisect-lk2009 | \
-               documented,git-remote-helpers | \
-               documented,gitworkflows | \
-               documented,gitcredentials | \
-               documented,gitnamespaces | \
-               documented,gitweb.conf | \
-               sentinel,not,matching,is,ok ) continue ;; \
-               esac; \
                case " $(ALL_COMMANDS) " in \
                *" $$cmd "*)    ;; \
                *) echo "removed but $$how: $$cmd" ;; \