git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Allow Overriding GIT_BUILD_DIR

From
David A. Greene <greened@obbligato.org>
Date
Feb 5, 2012, 22:28 UTC
Message-ID
<87vcmu5psm.fsf@smith.obbligato.org>

Let tests override GIT_BUILD_DIR so git will work if tests are not at the same directory level as standard git tests. Prior to this change, GIT_BUILD_DIR is hardwired to be exactly one directory above where the test lives. A test within contrib/, for example, can now use test-lib.sh and set an appropriate value for GIT_BUILD_DIR.

Signed-off-by: David A. Greene <greened@obbligato.org>
---
 t/test-lib.sh |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
------------------
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a65dfc7..4585138 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -55,6 +55,7 @@ unset $(perl -e '
 		.*_TEST
 		PROVE
 		VALGRIND
+                BUILD_DIR
 	));
 	my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
 	print join("\n", @vars);
@@ -901,7 +902,14 @@ then
 	# itself.
 	TEST_DIRECTORY=$(pwd)
 fi
-GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+
+if test -z "$GIT_BUILD_DIR"
+then
+	# We allow tests to override this, in case they want to run tests
+	# outside of t/, e.g. for running tests on the test library
+	# itself.
+        GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+fi
 
 if test -n "$valgrind"
 then

--------------------
Next: Junio C Hamano
Message 1 of 4 in “Allow Overriding GIT_BUILD_DIR”
  1. Allow Overriding GIT_BUILD_DIRDavid A. Greene, Feb 5, 2012
  2. Junio C HamanoFeb 26, 2012
  3. David A. GreeneMar 2, 2012
  4. Thomas RastMar 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.