]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Makefile: Fix CDPATH problem
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 20 Mar 2010 00:06:15 +0000 (19:06 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 20 Mar 2010 15:25:31 +0000 (08:25 -0700)
If CDPATH is set, "cd" prints its destination to stdout, causing
the common (cd a && tar cf - .) | (cd b && tar xf -) idiom to fail.
For example:

 make -C templates DESTDIR='' install
 make[1]: Entering directory `/users/e477610/exptool/src/git-1.7.0.2/templates'
 install -d -m 755 '/home/e477610/exptool/share/git-core/templates'
 (cd blt && gtar cf - .) | \
(cd '/home/e477610/exptool/share/git-core/templates' && umask 022 && gtar xof -)
 gtar: This does not look like a tar archive

Most git scripts already protect against use of CDPATH through
git-sh-setup, but the Makefile doesn’t.

Reported-by: Michael Cox <mhcox@bluezoosoftware.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile

index 4387d4207f49d4b80e8e922ccc85bf157447aa0b..98372ebbfcabc0b96d33bdcde045ff73de971e28 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -317,6 +317,12 @@ SCRIPT_PYTHON =
 SCRIPT_SH =
 TEST_PROGRAMS =
 
+# Having this variable in your environment would break pipelines because
+# you cause "cd" to echo its destination to stdout.  It can also take
+# scripts to unexpected places.  If you like CDPATH, define it for your
+# interactive shell sessions without exporting it.
+unexport CDPATH
+
 SCRIPT_SH += git-am.sh
 SCRIPT_SH += git-bisect.sh
 SCRIPT_SH += git-difftool--helper.sh