@matheusbsbs / matheus-bagliano / commits / 365527adbf
Fork 0

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 <junkio@cox.net>

Junio C Hamano committed Sep 12, 2005 at 19:47 UTC 365527adbfa8a16dfc05ab71818602f55ada55ba
2 files changed +9
git-clone.sh
+3
@@ -5,6 +5,9 @@
5 #
6 # Clone a repository into a different directory that does not yet exist.
7
8 +# See git-sh-setup why.
9 +unset CDPATH
10 +
11 usage() {
12 echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] <repo> <dir>"
13 exit 1
git-sh-setup.sh
+6
@@ -6,6 +6,12 @@
6 : ${GIT_DIR=.git}
7 : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
8
9 +# Having this variable in your environment would break scripts because
10 +# you would cause "cd" to be be taken to unexpected places. If you
11 +# like CDPATH, define it for your interactive shell sessions without
12 +# exporting it.
13 +unset CDPATH
14 +
15 die() {
16 echo "$@" >&2
17 exit 1