Fix clone not to ignore depth when performing a local clone
PATCH 1/1 Fix clone not to ignore depth when performing a local clone
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.
--- git-clone.sh | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
git-clone.sh +4 -1
@@ -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"
Signature · 1 line
1.5.3.7.2242.gcc945-dirty
Hi,
git-clone.sh fi · line 212
Quoted 10 lines · Charles Bailey
git-clone.sh +4
-1@@ -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
Quoted 20 lines · Johannes Schindelin
Hi,
git-clone.sh fi · line 212
Quoted 10 lines · Charles Bailey
git-clone.sh +4
-1@@ -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 fiOr shorter:
(quoted diff) +1
-1- local=yes + test -z "$depth" && local=yes
Quoted 3 lines
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.