Skip to content

Commit 1c867aa

Browse files
committed
Merge branch 'js/misc-doc-fixes' into pu
"make check-docs", "git help -a", etc. did not account for cases where a particular build may deliberately omit some subcommands, which has been corrected. Under review. * js/misc-doc-fixes: test-tool: handle the `-C <directory>` option just like `git` check-docs: do not bother checking for legacy scripts' documentation SQUASH??? docs: exclude documentation for commands that have been excluded check-docs: do not pretend that commands are listed which are excluded help -a: do not list commands that are excluded from the build remote-testgit: move it into the support directory for t5801
2 parents 974e157 + 79be736 commit 1c867aa

File tree

8 files changed

+67
-23
lines changed

8 files changed

+67
-23
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
/git-remote-ftps
136136
/git-remote-fd
137137
/git-remote-ext
138-
/git-remote-testgit
139138
/git-remote-testpy
140139
/git-remote-testsvn
141140
/git-repack

Documentation/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ manpage-base-url.xsl
1414
SubmittingPatches.txt
1515
tmp-doc-diff/
1616
GIT-ASCIIDOCFLAGS
17+
/GIT-EXCLUDED-PROGRAMS

Documentation/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ ARTICLES =
77
SP_ARTICLES =
88
OBSOLETE_HTML =
99

10+
-include GIT-EXCLUDED-PROGRAMS
11+
1012
MAN1_TXT += $(filter-out \
13+
$(patsubst %,%.txt,$(EXCLUDED_PROGRAMS)) \
1114
$(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
1215
$(wildcard git-*.txt))
1316
MAN1_TXT += git.txt

Makefile

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ FUZZ_PROGRAMS =
592592
LIB_OBJS =
593593
PROGRAM_OBJS =
594594
PROGRAMS =
595+
EXCLUDED_PROGRAMS =
595596
SCRIPT_PERL =
596597
SCRIPT_PYTHON =
597598
SCRIPT_SH =
@@ -614,7 +615,6 @@ SCRIPT_SH += git-merge-resolve.sh
614615
SCRIPT_SH += git-mergetool.sh
615616
SCRIPT_SH += git-quiltimport.sh
616617
SCRIPT_SH += git-legacy-stash.sh
617-
SCRIPT_SH += git-remote-testgit.sh
618618
SCRIPT_SH += git-request-pull.sh
619619
SCRIPT_SH += git-submodule.sh
620620
SCRIPT_SH += git-web--browse.sh
@@ -637,8 +637,6 @@ SCRIPT_PERL += git-svn.perl
637637

638638
SCRIPT_PYTHON += git-p4.py
639639

640-
NO_INSTALL += git-remote-testgit
641-
642640
# Generated files for scripts
643641
SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
644642
SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
@@ -1344,6 +1342,7 @@ ifdef NO_CURL
13441342
REMOTE_CURL_PRIMARY =
13451343
REMOTE_CURL_ALIASES =
13461344
REMOTE_CURL_NAMES =
1345+
EXCLUDED_PROGRAMS += git-http-fetch git-http-push
13471346
else
13481347
ifdef CURLDIR
13491348
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
@@ -1368,7 +1367,11 @@ endif
13681367
ifeq "$(curl_check)" "070908"
13691368
ifndef NO_EXPAT
13701369
PROGRAM_OBJS += http-push.o
1370+
else
1371+
EXCLUDED_PROGRAMS += git-http-push
13711372
endif
1373+
else
1374+
EXCLUDED_PROGRAMS += git-http-push
13721375
endif
13731376
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
13741377
ifeq "$(curl_check)" "072200"
@@ -1616,6 +1619,7 @@ ifdef NO_INET_PTON
16161619
endif
16171620
ifdef NO_UNIX_SOCKETS
16181621
BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1622+
EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
16191623
else
16201624
LIB_OBJS += unix-socket.o
16211625
PROGRAM_OBJS += credential-cache.o
@@ -2135,7 +2139,9 @@ $(BUILT_INS): git$X
21352139
command-list.h: generate-cmdlist.sh command-list.txt
21362140

21372141
command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
2138-
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
2142+
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2143+
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2144+
command-list.txt >$@+ && mv $@+ $@
21392145

21402146
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
21412147
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
@@ -2468,22 +2474,26 @@ $(VCSSVN_LIB): $(VCSSVN_OBJS)
24682474

24692475
export DEFAULT_EDITOR DEFAULT_PAGER
24702476

2477+
Documentation/GIT-EXCLUDED-PROGRAMS: Makefile config.mak.uname \
2478+
$(wildcard config.mak.autogen) $(wildcard config.mak)
2479+
$(QUIET_GEN)echo "EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)" >$@
2480+
24712481
.PHONY: doc man man-perl html info pdf
2472-
doc: man-perl
2482+
doc: man-perl Documentation/GIT-EXCLUDED-PROGRAMS
24732483
$(MAKE) -C Documentation all
24742484

2475-
man: man-perl
2485+
man: man-perl Documentation/GIT-EXCLUDED-PROGRAMS
24762486
$(MAKE) -C Documentation man
24772487

24782488
man-perl: perl/build/man/man3/Git.3pm
24792489

2480-
html:
2490+
html: Documentation/GIT-EXCLUDED-PROGRAMS
24812491
$(MAKE) -C Documentation html
24822492

2483-
info:
2493+
info: Documentation/GIT-EXCLUDED-PROGRAMS
24842494
$(MAKE) -C Documentation info
24852495

2486-
pdf:
2496+
pdf: Documentation/GIT-EXCLUDED-PROGRAMS
24872497
$(MAKE) -C Documentation pdf
24882498

24892499
XGETTEXT_FLAGS = \
@@ -2923,33 +2933,33 @@ endif
29232933
install-gitweb:
29242934
$(MAKE) -C gitweb install
29252935

2926-
install-doc: install-man-perl
2936+
install-doc: install-man-perl Documentation/GIT-EXCLUDED-PROGRAMS
29272937
$(MAKE) -C Documentation install
29282938

2929-
install-man: install-man-perl
2939+
install-man: install-man-perl Documentation/GIT-EXCLUDED-PROGRAMS
29302940
$(MAKE) -C Documentation install-man
29312941

2932-
install-man-perl: man-perl
2942+
install-man-perl: man-perl Documentation/GIT-EXCLUDED-PROGRAMS
29332943
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
29342944
(cd perl/build/man/man3 && $(TAR) cf - .) | \
29352945
(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
29362946

2937-
install-html:
2947+
install-html: Documentation/GIT-EXCLUDED-PROGRAMS
29382948
$(MAKE) -C Documentation install-html
29392949

2940-
install-info:
2950+
install-info: Documentation/GIT-EXCLUDED-PROGRAMS
29412951
$(MAKE) -C Documentation install-info
29422952

2943-
install-pdf:
2953+
install-pdf: Documentation/GIT-EXCLUDED-PROGRAMS
29442954
$(MAKE) -C Documentation install-pdf
29452955

2946-
quick-install-doc:
2956+
quick-install-doc: Documentation/GIT-EXCLUDED-PROGRAMS
29472957
$(MAKE) -C Documentation quick-install
29482958

2949-
quick-install-man:
2959+
quick-install-man: Documentation/GIT-EXCLUDED-PROGRAMS
29502960
$(MAKE) -C Documentation quick-install-man
29512961

2952-
quick-install-html:
2962+
quick-install-html: Documentation/GIT-EXCLUDED-PROGRAMS
29532963
$(MAKE) -C Documentation quick-install-html
29542964

29552965

@@ -3004,7 +3014,7 @@ artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
30043014
htmldocs = git-htmldocs-$(GIT_VERSION)
30053015
manpages = git-manpages-$(GIT_VERSION)
30063016
.PHONY: dist-doc distclean
3007-
dist-doc:
3017+
dist-doc: Documentation/GIT-EXCLUDED-PROGRAMS
30083018
$(RM) -r .doc-tmp-dir
30093019
mkdir .doc-tmp-dir
30103020
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
@@ -3051,6 +3061,7 @@ clean: profile-clean coverage-clean cocciclean
30513061
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
30523062
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
30533063
$(MAKE) -C Documentation/ clean
3064+
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
30543065
ifndef NO_PERL
30553066
$(MAKE) -C gitweb clean
30563067
$(RM) -r perl/build/
@@ -3078,15 +3089,15 @@ ALL_COMMANDS += gitweb
30783089
ALL_COMMANDS += git-gui git-citool
30793090

30803091
.PHONY: check-docs
3081-
check-docs::
3092+
check-docs:: Documentation/GIT-EXCLUDED-PROGRAMS
30823093
$(MAKE) -C Documentation lint-docs
30833094
@(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
30843095
do \
30853096
case "$$v" in \
30863097
git-merge-octopus | git-merge-ours | git-merge-recursive | \
30873098
git-merge-resolve | git-merge-subtree | \
30883099
git-fsck-objects | git-init-db | \
3089-
git-remote-* | git-stage | \
3100+
git-remote-* | git-stage | git-legacy-* | \
30903101
git-?*--?* ) continue ;; \
30913102
esac ; \
30923103
test -f "Documentation/$$v.txt" || \
@@ -3101,6 +3112,7 @@ check-docs::
31013112
( \
31023113
sed -e '1,/^### command list/d' \
31033114
-e '/^#/d' \
3115+
$(patsubst %,-e '/^% /d',$(EXCLUDED_PROGRAMS)) \
31043116
-e '/guide$$/d' \
31053117
-e 's/[ ].*//' \
31063118
-e 's/^/listed /' command-list.txt; \

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 "a$1" = "a--exclude-program"
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;

t/helper/test-tool.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#include "git-compat-util.h"
22
#include "test-tool.h"
33
#include "trace2.h"
4+
#include "parse-options.h"
5+
6+
static const char * const test_tool_usage[] = {
7+
"test-tool [-C <directory>] <command [<arguments>...]]",
8+
NULL
9+
};
410

511
struct test_cmd {
612
const char *name;
@@ -75,11 +81,24 @@ static NORETURN void die_usage(void)
7581
int cmd_main(int argc, const char **argv)
7682
{
7783
int i;
84+
const char *working_directory = NULL;
85+
struct option options[] = {
86+
OPT_STRING('C', NULL, &working_directory, "directory",
87+
"change the working directory"),
88+
OPT_END()
89+
};
7890

7991
BUG_exit_code = 99;
92+
argc = parse_options(argc, argv, NULL, options, test_tool_usage,
93+
PARSE_OPT_STOP_AT_NON_OPTION |
94+
PARSE_OPT_KEEP_ARGV0);
95+
8096
if (argc < 2)
8197
die_usage();
8298

99+
if (working_directory && chdir(working_directory) < 0)
100+
die("Could not cd to '%s'", working_directory);
101+
83102
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
84103
if (!strcmp(cmds[i].name, argv[1])) {
85104
argv++;

t/t5801-remote-helpers.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ test_description='Test remote-helper import and export commands'
88
. ./test-lib.sh
99
. "$TEST_DIRECTORY"/lib-gpg.sh
1010

11+
PATH="$TEST_DIRECTORY/t5801:$PATH"
12+
1113
compare_refs() {
1214
git --git-dir="$1/.git" rev-parse --verify $2 >expect &&
1315
git --git-dir="$3/.git" rev-parse --verify $4 >actual &&
File renamed without changes.

0 commit comments

Comments
 (0)