diff options
Diffstat (limited to 'git_superproject.py')
-rw-r--r-- | git_superproject.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/git_superproject.py b/git_superproject.py index 57a3a533..378ede25 100644 --- a/git_superproject.py +++ b/git_superproject.py | |||
@@ -112,11 +112,14 @@ class Superproject(object): | |||
112 | return False | 112 | return False |
113 | return True | 113 | return True |
114 | 114 | ||
115 | def _LsTree(self): | 115 | def _LsTree(self, branch='HEAD'): |
116 | """Returns the data from 'git ls-tree -r HEAD'. | 116 | """Returns the data from 'git ls-tree -r <branch>'. |
117 | 117 | ||
118 | Works only in git repositories. | 118 | Works only in git repositories. |
119 | 119 | ||
120 | Args: | ||
121 | branch: The branchname to be passed as argument to git ls-tree. | ||
122 | |||
120 | Returns: | 123 | Returns: |
121 | data: data returned from 'git ls-tree -r HEAD' instead of None. | 124 | data: data returned from 'git ls-tree -r HEAD' instead of None. |
122 | """ | 125 | """ |
@@ -125,7 +128,8 @@ class Superproject(object): | |||
125 | file=sys.stderr) | 128 | file=sys.stderr) |
126 | return None | 129 | return None |
127 | data = None | 130 | data = None |
128 | cmd = ['ls-tree', '-z', '-r', 'HEAD'] | 131 | cmd = ['ls-tree', '-z', '-r', branch] |
132 | |||
129 | p = GitCommand(None, | 133 | p = GitCommand(None, |
130 | cmd, | 134 | cmd, |
131 | cwd=self._work_git, | 135 | cwd=self._work_git, |
@@ -165,7 +169,7 @@ class Superproject(object): | |||
165 | if not self._Clone(url, branch): | 169 | if not self._Clone(url, branch): |
166 | raise GitError('git clone failed for url: %s' % url) | 170 | raise GitError('git clone failed for url: %s' % url) |
167 | 171 | ||
168 | data = self._LsTree() | 172 | data = self._LsTree(branch) |
169 | if not data: | 173 | if not data: |
170 | raise GitError('git ls-tree failed for url: %s' % url) | 174 | raise GitError('git ls-tree failed for url: %s' % url) |
171 | 175 | ||