]> git.ipfire.org Git - thirdparty/git.git/commitdiff
GIT-BUILD-OPTIONS: propagate project's source directory
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 07:45:49 +0000 (08:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 19:40:02 +0000 (11:40 -0800)
A couple of our tests require knowledge around where to find the
project's source directory in order to locate files required for the
test itself. Until now we have been wiring these up ad-hoc via new,
specialized variables catered to the specific usecase. This is quite
awkward though, as every test that potentially needs to locate paths
relative to the source directory needs to grow another variable.

Introduce a new "GIT_SOURCE_DIR" variable into GIT-BUILD-OPTIONS to stop
this proliferation. Remove existing variables that can be derived from
it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
GIT-BUILD-OPTIONS.in
Makefile
contrib/buildsystems/CMakeLists.txt
meson.build
t/lib-gettext.sh
t/t7609-mergetool--lib.sh

index ada575fbcb761f7d273a5685188c45f141668145..0a9884e0ade556c7c01f5efff29b7a9778cc80d9 100644 (file)
@@ -9,14 +9,13 @@ 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_SOURCE_DIR=@GIT_SOURCE_DIR@
 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@
index cd0806e1e692232d9b21541b20d07e06f55c4e3d..a3483e15c4ae4afef5a94c932b3e3feb1dd88368 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3192,14 +3192,13 @@ GIT-BUILD-OPTIONS: FORCE
                -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_SOURCE_DIR@|\'$(shell pwd)\'|" \
                -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)\'|" \
index 3179e7ff7a3593b41ababfe5f4f4f3c1d3088983..c6fbd57e158bc145c58144a7ecfe4aed3244b782 100644 (file)
@@ -1169,14 +1169,13 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
 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_SOURCE_DIR@" "${CMAKE_SOURCE_DIR}" 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}")
index 0df3872c6ada2421dd262e17895b323f5fb4d1ac..d77d7b6b6030dc54bafd9ed288d592625a5d3bcf 100644 (file)
@@ -1960,10 +1960,9 @@ subdir('contrib')
 
 foreach key, value : {
   'DIFF': diff.full_path(),
+  'GIT_SOURCE_DIR': meson.project_source_root(),
   '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'),
index 7a734c6973e65995d3403a26cc9e5c1a5a1ce074..b3dd68b0b95850b6ea63390766dc985a4fe069c7 100644 (file)
@@ -7,7 +7,7 @@
 . ./test-lib.sh
 
 GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
-GIT_PO_PATH="$GIT_TEST_POPATH"
+GIT_PO_PATH="$GIT_SOURCE_DIR/po"
 export GIT_TEXTDOMAINDIR GIT_PO_PATH
 
 if test -n "$GIT_TEST_INSTALLED"
index e8e205707e4ef7cdbdd73633961822911af4fd0a..af3ad284eeda00b15cde8f63bd2ff7c9d99fc91d 100755 (executable)
@@ -7,7 +7,7 @@ Testing basic merge tools options'
 . ./test-lib.sh
 
 test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
-       . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
+       . "$GIT_SOURCE_DIR"/mergetools/vimdiff &&
        run_unit_tests
 '