]> git.ipfire.org Git - thirdparty/git.git/commitdiff
use build-time SHELL_PATH in test scripts
authorJeff King <peff@peff.net>
Sun, 24 Feb 2008 19:40:45 +0000 (14:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Feb 2008 08:00:29 +0000 (00:00 -0800)
The top-level Makefile now creates a GIT-BUILD-OPTIONS file
which stores any options selected by the make process that
may be of use to further parts of the build process.
Specifically, we store the SHELL_PATH so that it can be used
by tests to construct shell scripts on the fly.

The format of the GIT-BUILD-OPTIONS file is Bourne shell,
and it is sourced by test-lib.sh; all tests can rely on just
having $SHELL_PATH correctly set in the environment.

The GIT-BUILD-OPTIONS file is written every time the
toplevel 'make' is invoked. Since the only users right now
are the test scripts, there's no drawback to updating its
timestamp. If something build-related depends on this, we
can do a trick similar to the one used by GIT-CFLAGS.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
.gitignore
Makefile
t/t3404-rebase-interactive.sh
t/test-lib.sh

index 165b256e2e81ef36ca6b8f9dd8db8d0cc4f164d4..4ff2fec2785d21055bdcb5d9661d5090624b92da 100644 (file)
@@ -1,3 +1,4 @@
+GIT-BUILD-OPTIONS
 GIT-CFLAGS
 GIT-GUI-VARS
 GIT-VERSION-FILE
index a5b6eebf1a0b65b481f6dd8f1e38006b46e87c83..c2f84a76f62171fe32ffe1770a10721f516f8169 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -812,7 +812,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
 
 ### Build rules
 
-all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS)
+all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
 ifneq (,$X)
        $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$p';)
 endif
@@ -1011,6 +1011,9 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
                echo "$$FLAGS" >GIT-CFLAGS; \
             fi
 
+GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
+       @echo SHELL_PATH=\''$(SHELL_PATH_SQ)'\' >$@
+
 ### Detect Tck/Tk interpreter path changes
 ifndef NO_TCLTK
 TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
@@ -1166,10 +1169,11 @@ ifndef NO_TCLTK
        $(MAKE) -C gitk-git clean
        $(MAKE) -C git-gui clean
 endif
-       $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
+       $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
 
 .PHONY: all install clean strip
 .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS
+.PHONY: .FORCE-GIT-BUILD-OPTIONS
 
 ### Check documentation
 #
index 62e65d704b37eb92509a8ad7e844cea8a675ed50..049aa375381b5929d1f35b7316c3fe6a647e4f93 100755 (executable)
@@ -61,7 +61,7 @@ test_expect_success 'setup' '
        git tag I
 '
 
-echo "#!$SHELL" >fake-editor
+echo "#!$SHELL_PATH" >fake-editor.sh
 cat >> fake-editor.sh <<\EOF
 case "$1" in
 */COMMIT_EDITMSG)
index 90df619b9f67374c76ec7506836b78bd2c264cc7..68efda44928fdd119a6e052557a9833cf3d2c13a 100644 (file)
@@ -359,6 +359,8 @@ if ! test -x ../test-chmtime; then
        exit 1
 fi
 
+. ../GIT-BUILD-OPTIONS
+
 # Test repository
 test=trash
 rm -fr "$test"