Merge "Ignore clone-depth attribute when fetching to a mirror"
diff --git a/project.py b/project.py
index c2bedde..0f11096 100644
--- a/project.py
+++ b/project.py
@@ -1716,11 +1716,17 @@
 
     is_sha1 = False
     tag_name = None
+    depth = None
 
-    if self.clone_depth:
-      depth = self.clone_depth
-    else:
-      depth = self.manifest.manifestProject.config.GetString('repo.depth')
+    # The depth should not be used when fetching to a mirror because
+    # it will result in a shallow repository that cannot be cloned or
+    # fetched from.
+    if not self.manifest.IsMirror:
+      if self.clone_depth:
+        depth = self.clone_depth
+      else:
+        depth = self.manifest.manifestProject.config.GetString('repo.depth')
+
     if depth:
       current_branch_only = True