Merge branch 'ms/t7611-test-path-is-file'

Test modernization.

* ms/t7611-test-path-is-file:
  t7611: replace test -f with test_path_is* helpers
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index db17bc7..958e3cc 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -692,16 +692,17 @@
 Some parts of the system have dedicated maintainers with their own
 repositories.
 
-- `git-gui/` comes from git-gui project, maintained by Johannes Sixt:
+- `git-gui/` comes from the git-gui project, maintained by Johannes Sixt:
 
         https://github.com/j6t/git-gui
 
-- `gitk-git/` comes from Paul Mackerras's gitk project:
+   Contibutions should go via the git mailing list.
 
-	git://git.ozlabs.org/~paulus/gitk
+- `gitk-git/` comes from the gitk project, maintained by Johannes Sixt:
 
-   Those who are interested in improving gitk can volunteer to help Paul
-   maintain it, cf. <YntxL/fTplFm8lr6@cleo>.
+	https://github.com/j6t/gitk
+
+   Contibutions should go via the git mailing list.
 
 - `po/` comes from the localization coordinator, Jiang Xin:
 
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f651116..edff75a 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,47 +1,48 @@
-SHELL_PATH=@SHELL_PATH@
-TEST_SHELL_PATH=@TEST_SHELL_PATH@
-PERL_PATH=@PERL_PATH@
-PERL_LOCALEDIR=@PERL_LOCALEDIR@
-NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
 DIFF=@DIFF@
-PYTHON_PATH=@PYTHON_PATH@
-TAR=@TAR@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+GITWEBDIR=@GITWEBDIR@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+LOCALEDIR=@LOCALEDIR@
 NO_CURL=@NO_CURL@
-NO_ICONV=@NO_ICONV@
 NO_EXPAT=@NO_EXPAT@
-USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_GETTEXT=@NO_GETTEXT@
+NO_GITWEB=@NO_GITWEB@
+NO_ICONV=@NO_ICONV@
 NO_PERL=@NO_PERL@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
 NO_PTHREADS=@NO_PTHREADS@
 NO_PYTHON=@NO_PYTHON@
 NO_REGEX=@NO_REGEX@
 NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
 PAGER_ENV=@PAGER_ENV@
-SANITIZE_LEAK=@SANITIZE_LEAK@
-SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
-X=@X@
-FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
-FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
-TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
-GIT_TEST_OPTS=@GIT_TEST_OPTS@
-GIT_TEST_CMP=@GIT_TEST_CMP@
-GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
-GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
-NO_GETTEXT=@NO_GETTEXT@
-GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
-GIT_PERF_REPO=@GIT_PERF_REPO@
-GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
-GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
-GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
-GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
-GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
-GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
-GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
-GIT_TEST_POPATH=@GIT_TEST_POPATH@
-GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
-GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
-GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+PERL_PATH=@PERL_PATH@
+PYTHON_PATH=@PYTHON_PATH@
 RUNTIME_PREFIX=@RUNTIME_PREFIX@
-GITWEBDIR=@GITWEBDIR@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SHELL_PATH=@SHELL_PATH@
+TAR=@TAR@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
 USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
-LOCALEDIR=@LOCALEDIR@
-BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+X=@X@
diff --git a/Makefile b/Makefile
index 3fa4bf0..97e8385 100644
--- a/Makefile
+++ b/Makefile
@@ -3145,53 +3145,54 @@
 # and the first level quoting from the shell that runs "echo".
 GIT-BUILD-OPTIONS: FORCE
 	@sed \
-		-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-		-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-		-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
-		-e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
-		-e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
+		-e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
 		-e "s|@DIFF@|\'$(DIFF)\'|" \
-		-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-		-e "s|@TAR@|\'$(TAR)\'|" \
+		-e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+		-e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+		-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+		-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+		-e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+		-e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+		-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+		-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+		-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+		-e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+		-e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+		-e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+		-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+		-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
+		-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+		-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+		-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+		-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+		-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+		-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+		-e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
 		-e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
-		-e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
 		-e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
-		-e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+		-e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+		-e "s|@NO_GITWEB@|\'$(NO_GITWEB)\'|" \
+		-e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
 		-e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+		-e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
 		-e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
 		-e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
 		-e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
 		-e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
 		-e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
-		-e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
-		-e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
-		-e "s|@X@|\'$(X)\'|" \
-		-e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
-		-e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
-		-e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
-		-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
-		-e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
-		-e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
-		-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
-		-e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
-		-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
-		-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
-		-e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
-		-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
-		-e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
-		-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-		-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-		-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-		-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
-		-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
-		-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
-		-e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
-		-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
+		-e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+		-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+		-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
 		-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-		-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+		-e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+		-e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+		-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+		-e "s|@TAR@|\'$(TAR)\'|" \
+		-e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+		-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
 		-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
-		-e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
-		-e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
+		-e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+		-e "s|@X@|\'$(X)\'|" \
 		GIT-BUILD-OPTIONS.in >$@+
 	@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
 	@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 802445c..10dc54f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1158,53 +1158,54 @@
 endif()
 
 file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
-string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
-string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
-string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
-string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
-string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
 string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
-string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
-string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
 string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
-string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
 string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
-string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GITWEB@" "1" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
 string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
 string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
 string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
 string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
 string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
 string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
-string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
-string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
-string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
-string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
-string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
-string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
-string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
 string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
-string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
 string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
-string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
-string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
 if(USE_VCPKG)
 	string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
 endif()
diff --git a/meson.build b/meson.build
index a0654a3..0064eb6 100644
--- a/meson.build
+++ b/meson.build
@@ -1456,34 +1456,6 @@
   build_options_config.set('RUNTIME_PREFIX', 'false')
 endif
 
-foreach key, value : {
-  'DIFF': diff.full_path(),
-  'GIT_TEST_CMP': diff.full_path() + ' -u',
-  'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
-  'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
-  'GIT_TEST_POPATH': meson.project_source_root() / 'po',
-  'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
-  'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
-  'PAGER_ENV': get_option('pager_environment'),
-  'PERL_PATH': perl.found() ? perl.full_path() : '',
-  'PYTHON_PATH': python.found () ? python.full_path() : '',
-  'SHELL_PATH': shell.full_path(),
-  'TAR': tar.full_path(),
-  'TEST_OUTPUT_DIRECTORY': test_output_directory,
-  'TEST_SHELL_PATH': shell.full_path(),
-}
-  if value != '' and cygpath.found()
-    value = run_command(cygpath, value, check: true).stdout().strip()
-  endif
-  build_options_config.set_quoted(key, value)
-endforeach
-
-configure_file(
-  input: 'GIT-BUILD-OPTIONS.in',
-  output: 'GIT-BUILD-OPTIONS',
-  configuration: build_options_config,
-)
-
 git_version_file = custom_target(
   command: [
     shell,
@@ -1891,8 +1863,11 @@
 # We make sure further up that Perl is required in case the gitweb option is
 # enabled.
 gitweb_option = get_option('gitweb').disable_auto_if(not perl.found())
-if gitweb_option.enabled()
+if gitweb_option.allowed()
   subdir('gitweb')
+  build_options_config.set('NO_GITWEB', '')
+else
+  build_options_config.set('NO_GITWEB', '1')
 endif
 
 subdir('templates')
@@ -1909,11 +1884,39 @@
   subdir('Documentation')
 endif
 
+foreach key, value : {
+  'DIFF': diff.full_path(),
+  'GIT_TEST_CMP': diff.full_path() + ' -u',
+  'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+  'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+  'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+  'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+  'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+  'PAGER_ENV': get_option('pager_environment'),
+  'PERL_PATH': perl.found() ? perl.full_path() : '',
+  'PYTHON_PATH': python.found () ? python.full_path() : '',
+  'SHELL_PATH': shell.full_path(),
+  'TAR': tar.full_path(),
+  'TEST_OUTPUT_DIRECTORY': test_output_directory,
+  'TEST_SHELL_PATH': shell.full_path(),
+}
+  if value != '' and cygpath.found()
+    value = run_command(cygpath, value, check: true).stdout().strip()
+  endif
+  build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+  input: 'GIT-BUILD-OPTIONS.in',
+  output: 'GIT-BUILD-OPTIONS',
+  configuration: build_options_config,
+)
+
 summary({
   'curl': curl.found(),
   'expat': expat.found(),
   'gettext': intl.found(),
-  'gitweb': gitweb_option.enabled(),
+  'gitweb': gitweb_option.allowed(),
   'https': https_backend,
   'iconv': iconv.found(),
   'pcre2': pcre2.found(),
diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh
index 7f9808e..a6e3dd1 100644
--- a/t/lib-gitweb.sh
+++ b/t/lib-gitweb.sh
@@ -105,6 +105,11 @@
 	test_done
 fi
 
+if ! test_have_prereq GITWEB; then
+	skip_all='skipping gitweb tests, gitweb not available'
+	test_done
+fi
+
 perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
 	skip_all='skipping gitweb tests, perl version is too old'
 	test_done
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 62dfcc4..1a67adb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1687,6 +1687,7 @@
 
 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
 test -z "$NO_CURL" && test_set_prereq LIBCURL
+test -z "$NO_GITWEB" && test_set_prereq GITWEB
 test -z "$NO_ICONV" && test_set_prereq ICONV
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PTHREADS" && test_set_prereq PTHREADS