# [PATCH] unset CDPATH in git-clone

3 messages from 2005-09-01 to 2005-09-06. Participants: Carl Baldwin, Junio C Hamano.
Thread: https://gitlist.dev/t/1710

## Carl Baldwin, 2005-09-01 15:24

Subject: [PATCH] unset CDPATH in git-clone
Message-ID: <20050901152441.GA8694@hpsvcnb.fc.hp.com>
URL: https://gitlist.dev/e/20050901152441.GA8694%40hpsvcnb.fc.hp.com

```
Hello,

A colleague was having problems with git clone.  It seemed to work as
expected for me so I went into his environment to see what was causing
it to fail.  I found that he had set the CDPATH environment variable to
something like '.:..:../..:$HOME'.  Try this (using bash) and you'll see
the problem:

export CDPATH=.
git clone (anything local)

The function get_repo_base seems to break with this CDPATH.

Below is how I solved the problem for the short-term.  Use it as you see
fit.  I did not look into other commands to see if there are other
implications to using CDPATH.

Cheers,
Carl

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Carl Baldwin                        Systems VLSI Laboratory
 Hewlett Packard Company
 MS 88                               work: 970 898-1523
 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com
 Fort Collins, CO 80525              home: Carl@ecBaldwin.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---

 git-clone-script |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

50e48b03a5a82bb1e4ca95ef4e04cafc39a96f79
diff --git a/git-clone-script b/git-clone-script
--- a/git-clone-script
+++ b/git-clone-script
@@ -5,6 +5,8 @@
 # 
 # Clone a repository into a different directory that does not yet exist.
 
+unset CDPATH
+
 usage() {
 	echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] <repo> <dir>"
 	exit 1

```

## Junio C Hamano, 2005-09-05 19:37

Subject: Re: [PATCH] unset CDPATH in git-clone
Message-ID: <7v3boj486h.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v3boj486h.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050901152441.GA8694@hpsvcnb.fc.hp.com>

```
Carl Baldwin <cnb@fc.hp.com> writes:

> The function get_repo_base seems to break with this CDPATH.

Sorry, your message somehow slipped my filtering.  Thanks for
the analysis.  Of course, CDPATH would break it.

Is there any good reason why somebody would want to have CDPATH
in his environment, inherited to be used by any shell scripts,
as opposed to have it as a plain shell variable that is set only
in interactive shells?  I do not think of any.

```

## Carl Baldwin, 2005-09-06 14:52

Subject: Re: [PATCH] unset CDPATH in git-clone
Message-ID: <20050906145201.GA4551@hpsvcnb.fc.hp.com>
URL: https://gitlist.dev/e/20050906145201.GA4551%40hpsvcnb.fc.hp.com
In-Reply-To: <7v3boj486h.fsf@assigned-by-dhcp.cox.net>

```
On Mon, Sep 05, 2005 at 12:37:58PM -0700, Junio C Hamano wrote:
> Carl Baldwin <cnb@fc.hp.com> writes:
> 
> > The function get_repo_base seems to break with this CDPATH.
> 
> Sorry, your message somehow slipped my filtering.  Thanks for
> the analysis.  Of course, CDPATH would break it.
> 
> Is there any good reason why somebody would want to have CDPATH
> in his environment, inherited to be used by any shell scripts,
> as opposed to have it as a plain shell variable that is set only
> in interactive shells?  I do not think of any.

Good point.  There is no good reason at all.  It happens when one does
not know the difference between a plain shell variable and an
environment variable.

Carl

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Carl Baldwin                        Systems VLSI Laboratory
 Hewlett Packard Company
 MS 88                               work: 970 898-1523
 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com
 Fort Collins, CO 80525              home: Carl@ecBaldwin.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

```
