# [PATCH] Fix clone not to ignore depth when performing a local clone

3 messages from 2007-12-11 to 2007-12-11. Participants: Charles Bailey, Johannes Schindelin.
Thread: https://gitlist.dev/t/11236

## Charles Bailey, 2007-12-11 06:47

Subject: [PATCH] Fix clone not to ignore depth when performing a local clone
Message-ID: <20071211064731.GA30525@hashpling.org>
URL: https://gitlist.dev/e/20071211064731.GA30525%40hashpling.org

```
When git-clone detects that it can perform a local clone it
follows a path that silently ignores the depth parameter.

Presumably if the user explicitly requests a shallow clone they
have a reason to prefer a space efficient clone of just the recent
history so bypass the local magic if the user specifies the depth
parameter.

Signed-off-by: Charles Bailey <charles@hashpling.org>
---
 git-clone.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index ecf9d89..fb124d8 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -205,7 +205,10 @@ fi
 # it is local
 if base=$(get_repo_base "$repo"); then
 	repo="$base"
-	local=yes
+	if test -z "$depth"
+	then
+		local=yes
+	fi
 fi
 
 dir="$2"
-- 
1.5.3.7.2242.gcc945-dirty

```

## Johannes Schindelin, 2007-12-11 11:54

Subject: Re: [PATCH] Fix clone not to ignore depth when performing a local clone
Message-ID: <Pine.LNX.4.64.0712111154070.27959@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0712111154070.27959%40racer.site
In-Reply-To: <20071211064731.GA30525@hashpling.org>

```
Hi,

On Tue, 11 Dec 2007, Charles Bailey wrote:

> @@ -205,7 +205,10 @@ fi
>  # it is local
>  if base=$(get_repo_base "$repo"); then
>  	repo="$base"
> -	local=yes
> +	if test -z "$depth"
> +	then
> +		local=yes
> +	fi
>  fi

Or shorter:

-	local=yes
+	test -z "$depth" && local=yes

Ciao,
Dscho

```

## Charles Bailey, 2007-12-11 18:26

Subject: Re: [PATCH] Fix clone not to ignore depth when performing a local clone
Message-ID: <20071211182603.GA4063@hashpling.org>
URL: https://gitlist.dev/e/20071211182603.GA4063%40hashpling.org
In-Reply-To: <Pine.LNX.4.64.0712111154070.27959@racer.site>

```
On Tue, Dec 11, 2007 at 11:54:54AM +0000, Johannes Schindelin wrote:
> Hi,
> 
> On Tue, 11 Dec 2007, Charles Bailey wrote:
> 
> > @@ -205,7 +205,10 @@ fi
> >  # it is local
> >  if base=$(get_repo_base "$repo"); then
> >  	repo="$base"
> > -	local=yes
> > +	if test -z "$depth"
> > +	then
> > +		local=yes
> > +	fi
> >  fi
> 
> Or shorter:
> 
> -	local=yes
> +	test -z "$depth" && local=yes
> 
> Ciao,
> Dscho
> 

Yes, I have no particular preference. I was just following the
'convention' of the -z "$origin" test a few lines above although
I could see uses of both alternatives as well as instances of [...]
instead of test ... .

Charles.

```
