Skip to content

Commit c582364

Browse files
pks-tgitster
authored andcommitted
GIT-BUILD-OPTIONS: propagate project's source directory
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0394451 commit c582364

File tree

6 files changed

+6
-10
lines changed

6 files changed

+6
-10
lines changed

GIT-BUILD-OPTIONS.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
99
GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
1010
GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
1111
GIT_PERF_REPO=@GIT_PERF_REPO@
12+
GIT_SOURCE_DIR=@GIT_SOURCE_DIR@
1213
GIT_TEST_CMP=@GIT_TEST_CMP@
1314
GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
1415
GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
1516
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
16-
GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
1717
GIT_TEST_OPTS=@GIT_TEST_OPTS@
1818
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
19-
GIT_TEST_POPATH=@GIT_TEST_POPATH@
2019
GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
2120
GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
2221
GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -3192,14 +3192,13 @@ GIT-BUILD-OPTIONS: FORCE
31923192
-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
31933193
-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
31943194
-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
3195+
-e "s|@GIT_SOURCE_DIR@|\'$(shell pwd)\'|" \
31953196
-e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
31963197
-e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
31973198
-e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
31983199
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
3199-
-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
32003200
-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
32013201
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
3202-
-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
32033202
-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
32043203
-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
32053204
-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \

contrib/buildsystems/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,13 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
11691169
string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
11701170
string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
11711171
string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
1172+
string(REPLACE "@GIT_SOURCE_DIR@" "${CMAKE_SOURCE_DIR}" git_build_options "${git_build_options}")
11721173
string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
11731174
string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
11741175
string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
11751176
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
1176-
string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
11771177
string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
11781178
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
1179-
string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
11801179
string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
11811180
string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
11821181
string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")

meson.build

+1-2
Original file line numberDiff line numberDiff line change
@@ -1960,10 +1960,9 @@ subdir('contrib')
19601960

19611961
foreach key, value : {
19621962
'DIFF': diff.full_path(),
1963+
'GIT_SOURCE_DIR': meson.project_source_root(),
19631964
'GIT_TEST_CMP': diff.full_path() + ' -u',
19641965
'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
1965-
'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
1966-
'GIT_TEST_POPATH': meson.project_source_root() / 'po',
19671966
'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
19681967
'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
19691968
'PAGER_ENV': get_option('pager_environment'),

t/lib-gettext.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
. ./test-lib.sh
88

99
GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
10-
GIT_PO_PATH="$GIT_TEST_POPATH"
10+
GIT_PO_PATH="$GIT_SOURCE_DIR/po"
1111
export GIT_TEXTDOMAINDIR GIT_PO_PATH
1212

1313
if test -n "$GIT_TEST_INSTALLED"

t/t7609-mergetool--lib.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Testing basic merge tools options'
77
. ./test-lib.sh
88

99
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
10-
. "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
10+
. "$GIT_SOURCE_DIR"/mergetools/vimdiff &&
1111
run_unit_tests
1212
'
1313

0 commit comments

Comments
 (0)