Skip to contentSkip to conversation

Fix clone not to ignore depth when performing a local clone

PATCH In review Charles Bailey 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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
index ecf9d89..fb124d8 100755
@@ -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
#1 lore raw

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

#2 lore raw
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
 fi

Or 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.