Execute git command on a branch ref, trying local then remote. Helper for file/tree operations.
(self, cmd: List[str], branch: str, rel_path: str)
| 279 | return str(error) |
| 280 | |
| 281 | def _git_ref_output(self, cmd: List[str], branch: str, rel_path: str) -> Optional[str]: |
| 282 | """Execute git command on a branch ref, trying local then remote. Helper for file/tree operations.""" |
| 283 | result = self.run_git([*cmd, f"{branch}:{rel_path}"], check=False) |
| 284 | if result.returncode != 0 and (remote := self._find_apache_remote()): |
| 285 | result = self.run_git([*cmd, f"{remote}/{branch}:{rel_path}"], check=False) |
| 286 | return result.stdout if result.returncode == 0 else None |
| 287 | |
| 288 | def _get_file_from_branch(self, branch: str, rel_path: str) -> Optional[str]: |
| 289 | """Read a file from a branch, trying local first, then remote.""" |
no test coverage detected