diff --git a/tests/testcurl.pl b/tests/testcurl.pl
index b48c2842e08a689a400a471f4afb7b14cab41a6b..c55dcaeef663ff4813a00eee9971024ea2e82614 100755
--- a/tests/testcurl.pl
+++ b/tests/testcurl.pl
@@ -78,6 +78,10 @@ $fixed=0;
 # Determine if we're running from git or a canned copy of curl,
 # or if we got a specific target option or setup file option.
 $CURLDIR="curl";
+if (-f ".git/config") {
+  $CURLDIR = "./";
+}
+
 $git=1;
 $setupfile = 'setup';
 while ($ARGV[0]) {