From: Junio C Hamano Date: Tue, 13 Sep 2005 02:47:07 +0000 (-0700) Subject: Fix CDPATH problem. X-Git-Tag: v0.99.7~57 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=365527adbfa8a16dfc05ab71818602f55ada55ba;p=git.git Fix CDPATH problem. CDPATH has two problems: * It takes scripts to unexpected places (somebody had CDPATH=..:../..:$HOME and the "cd" in git-clone.sh:get_repo_base took him to $HOME/.git when he said "clone foo bar" to clone a repository in "foo" which had "foo/.git"). CDPATH mechanism does not implicitly give "." at the beginning of CDPATH, which is the most irritating part. * The extra echo when it does its thing confuses scripts further. Most of our scripts that use "cd" includes git-sh-setup so the problem is primarily fixed there. git-clone starts without a repository, and it needs its own fix. Signed-off-by: Junio C Hamano --- diff --git a/git-clone.sh b/git-clone.sh index c0762922..a21f13af 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -5,6 +5,9 @@ # # Clone a repository into a different directory that does not yet exist. +# See git-sh-setup why. +unset CDPATH + usage() { echo >&2 "* git clone [-l [-s]] [-q] [-u ] " exit 1 diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 06d8299c..d5bfa62d 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -6,6 +6,12 @@ : ${GIT_DIR=.git} : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} +# Having this variable in your environment would break scripts because +# you would cause "cd" to be be taken to unexpected places. If you +# like CDPATH, define it for your interactive shell sessions without +# exporting it. +unset CDPATH + die() { echo "$@" >&2 exit 1