Skip to content

Commit 5e87eae

Browse files
committed
test-lib: use DIFF definition from GIT-BUILD-OPTIONS
Otherwise running individual tests from t/ directory may lack the definition of $DIFF, $GIT_TEST_CMP and friends. Noticed and initial patch provided by Thomas Rast, alternative solution suggested by Brandon Casey, which this patch implements. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Thomas Rast <trast@student.ethz.ch>
1 parent 09ce4bb commit 5e87eae

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,6 +1944,12 @@ GIT-BUILD-OPTIONS: FORCE
19441944
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
19451945
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
19461946
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
1947+
ifdef GIT_TEST_CMP
1948+
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
1949+
endif
1950+
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1951+
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
1952+
endif
19471953

19481954
### Detect Tck/Tk interpreter path changes
19491955
ifndef NO_TCLTK

t/test-lib.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
6464
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
6565
export EDITOR
6666

67-
if test -z "$GIT_TEST_CMP"
68-
then
69-
if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
70-
then
71-
GIT_TEST_CMP="$DIFF -c"
72-
else
73-
GIT_TEST_CMP="$DIFF -u"
74-
fi
75-
fi
76-
7767
# Protect ourselves from common misconfiguration to export
7868
# CDPATH into the environment
7969
unset CDPATH
@@ -691,6 +681,16 @@ export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOB
691681

692682
. ../GIT-BUILD-OPTIONS
693683

684+
if test -z "$GIT_TEST_CMP"
685+
then
686+
if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
687+
then
688+
GIT_TEST_CMP="$DIFF -c"
689+
else
690+
GIT_TEST_CMP="$DIFF -u"
691+
fi
692+
fi
693+
694694
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
695695
export GITPERLLIB
696696
test -d ../templates/blt || {

0 commit comments

Comments
 (0)