Skip to content

Commit c40d92e

Browse files
jrngitster
authored andcommitted
Makefile: Fix CDPATH problem
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 <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d12e59 commit c40d92e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ SCRIPT_PYTHON =
317317
SCRIPT_SH =
318318
TEST_PROGRAMS =
319319

320+
# Having this variable in your environment would break pipelines because
321+
# you cause "cd" to echo its destination to stdout. It can also take
322+
# scripts to unexpected places. If you like CDPATH, define it for your
323+
# interactive shell sessions without exporting it.
324+
unexport CDPATH
325+
320326
SCRIPT_SH += git-am.sh
321327
SCRIPT_SH += git-bisect.sh
322328
SCRIPT_SH += git-difftool--helper.sh

0 commit comments

Comments
 (0)