Merge commits up to v2.13.8

* tag 'v2.13.8':
  forall: handle missing project refs better
  sync: imply -c if --use-superproject option is used.
  start: add a --HEAD alias
  forall/list: delete spurious "
  superproject: Added --depth=1 argument to git fetch command.

Change-Id: Ic2e4e637907d78914206bd4818446b65be6034da
diff --git a/git_superproject.py b/git_superproject.py
index 7f0582c..8932097 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -121,7 +121,7 @@
       print('git fetch missing drectory: %s' % self._work_git,
             file=sys.stderr)
       return False
-    cmd = ['fetch', url, '--force', '--no-tags', '--filter', 'blob:none']
+    cmd = ['fetch', url, '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none']
     if self._branch:
       cmd += [self._branch + ':' + self._branch]
     p = GitCommand(None,
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 872c95c..f0ce97c 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -24,6 +24,7 @@
 
 from color import Coloring
 from command import DEFAULT_LOCAL_JOBS, Command, MirrorSafeCommand, WORKER_BATCH_SIZE
+from error import ManifestInvalidRevisionError
 
 _CAN_COLOR = [
     'branch',
@@ -44,7 +45,7 @@
   helpSummary = "Run a shell command in each project"
   helpUsage = """
 %prog [<project>...] -c <command> [<arg>...]
-%prog -r str1 [str2] ... -c <command> [<arg>...]"
+%prog -r str1 [str2] ... -c <command> [<arg>...]
 """
   helpDescription = """
 Executes the same shell command in each project.
@@ -252,7 +253,7 @@
       rc = rc or errno.EINTR
     except Exception as e:
       # Catch any other exceptions raised
-      print('Got an error, terminating the pool: %s: %s' %
+      print('forall: unhandled error, terminating the pool: %s: %s' %
             (type(e).__name__, e),
             file=sys.stderr)
       rc = rc or getattr(e, 'errno', 1)
@@ -295,7 +296,13 @@
   setenv('REPO_PROJECT', project.name)
   setenv('REPO_PATH', project.relpath)
   setenv('REPO_REMOTE', project.remote.name)
-  setenv('REPO_LREV', '' if mirror else project.GetRevisionId())
+  try:
+    # If we aren't in a fully synced state and we don't have the ref the manifest
+    # wants, then this will fail.  Ignore it for the purposes of this code.
+    lrev = '' if mirror else project.GetRevisionId()
+  except ManifestInvalidRevisionError:
+    lrev = ''
+  setenv('REPO_LREV', lrev)
   setenv('REPO_RREV', project.revisionExpr)
   setenv('REPO_UPSTREAM', project.upstream)
   setenv('REPO_DEST_BRANCH', project.dest_branch)
diff --git a/subcmds/list.py b/subcmds/list.py
index a1247b7..7825dee 100644
--- a/subcmds/list.py
+++ b/subcmds/list.py
@@ -20,7 +20,7 @@
   helpSummary = "List projects and their associated directories"
   helpUsage = """
 %prog [-f] [<project>...]
-%prog [-f] -r str1 [str2]..."
+%prog [-f] -r str1 [str2]...
 """
   helpDescription = """
 List all projects; pass '.' to list the project for the cwd.
diff --git a/subcmds/start.py b/subcmds/start.py
index 25b229f..04589fb 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -44,7 +44,8 @@
                  help='begin branch in all projects')
     p.add_option('-r', '--rev', '--revision', dest='revision',
                  help='point branch at this revision instead of upstream')
-    p.add_option('--head', dest='revision', action='store_const', const='HEAD',
+    p.add_option('--head', '--HEAD',
+                 dest='revision', action='store_const', const='HEAD',
                  help='abbreviation for --rev HEAD')
 
   def ValidateOptions(self, opt, args):
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 76917cd..ba016e8 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -282,6 +282,16 @@
       branch = branch[len(R_HEADS):]
     return branch
 
+  def _UseSuperproject(self, opt):
+    """Returns True if use-superproject option is enabled"""
+    return (opt.use_superproject or
+            self.manifest.manifestProject.config.GetBoolean(
+                'repo.superproject'))
+
+  def _GetCurrentBranchOnly(self, opt):
+    """Returns True if current-branch or use-superproject options are enabled."""
+    return opt.current_branch_only or self._UseSuperproject(opt)
+
   def _UpdateProjectsRevisionId(self, opt, args):
     """Update revisionId of every project with the SHA from superproject.
 
@@ -368,7 +378,7 @@
             quiet=opt.quiet,
             verbose=opt.verbose,
             output_redir=buf,
-            current_branch_only=opt.current_branch_only,
+            current_branch_only=self._GetCurrentBranchOnly(opt),
             force_sync=opt.force_sync,
             clone_bundle=opt.clone_bundle,
             tags=opt.tags, archive=self.manifest.IsArchive,
@@ -741,7 +751,7 @@
     if not opt.local_only:
       start = time.time()
       success = mp.Sync_NetworkHalf(quiet=opt.quiet, verbose=opt.verbose,
-                                    current_branch_only=opt.current_branch_only,
+                                    current_branch_only=self._GetCurrentBranchOnly(opt),
                                     force_sync=opt.force_sync,
                                     tags=opt.tags,
                                     optimized_fetch=opt.optimized_fetch,
@@ -849,9 +859,7 @@
     else:
       self._UpdateManifestProject(opt, mp, manifest_name)
 
-    if (opt.use_superproject or
-        self.manifest.manifestProject.config.GetBoolean(
-            'repo.superproject')):
+    if self._UseSuperproject(opt):
       manifest_name = self._UpdateProjectsRevisionId(opt, args)
 
     if self.gitc_manifest: