superproject: Pass branch to git ls-tree.

Tested the code with the following commands.

$ ./run_tests -v

Bug: [google internal] b/179702819
Bug: https://crbug.com/gerrit/13709
Bug: https://crbug.com/gerrit/13707
Tested-by: Raman Tenneti <rtenneti@google.com>
Change-Id: I7d2b609ac2f927c94701757aa1502ba236afe7c0
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296342
Reviewed-by: Mike Frysinger <vapier@google.com>
diff --git a/git_superproject.py b/git_superproject.py
index 57a3a53..378ede2 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -112,11 +112,14 @@
       return False
     return True
 
-  def _LsTree(self):
-    """Returns the data from 'git ls-tree -r HEAD'.
+  def _LsTree(self, branch='HEAD'):
+    """Returns the data from 'git ls-tree -r <branch>'.
 
     Works only in git repositories.
 
+    Args:
+      branch: The branchname to be passed as argument to git ls-tree.
+
     Returns:
       data: data returned from 'git ls-tree -r HEAD' instead of None.
     """
@@ -125,7 +128,8 @@
             file=sys.stderr)
       return None
     data = None
-    cmd = ['ls-tree', '-z', '-r', 'HEAD']
+    cmd = ['ls-tree', '-z', '-r', branch]
+
     p = GitCommand(None,
                    cmd,
                    cwd=self._work_git,
@@ -165,7 +169,7 @@
       if not self._Clone(url, branch):
         raise GitError('git clone failed for url: %s' % url)
 
-    data = self._LsTree()
+    data = self._LsTree(branch)
     if not data:
       raise GitError('git ls-tree failed for url: %s' % url)