Permalink
Browse files

Use plumbing tools, branches.

I decided to switch over to git's plumbing tools as the output of them is intended for parsing and it's format changes less often.
  • Loading branch information...
1 parent f5a9203 commit c076d4874048d3c929bfa0e43e7c3bf73fa21726 @Corni committed Apr 9, 2009
Showing with 2 additions and 4 deletions.
  1. +2 −4 versioncontrol_git.log.inc
@@ -148,7 +148,7 @@ function _versioncontrol_git_log_exec($command, &$temp_file) {
* @return array List of branches.
*/
function _versioncontrol_git_log_get_branches() {
- $logs = _versioncontrol_git_log_exec('git branch -l', $temp_file); // Query branches.
+ $logs = _versioncontrol_git_log_exec('git show-ref --heads', $temp_file); // Query branches.
$branches = _versioncontrol_git_log_parse_branches($logs); // Parse output.
if (variable_get('versioncontrol_git_log_use_file', 1)) { // Close file.
fclose($logs);
@@ -167,9 +167,7 @@ function _versioncontrol_git_log_parse_branches(&$logs) {
$next = is_array($logs) ? 'next' : 'fgets';
$branches = array();
while (($line = $next($logs)) !== FALSE) {
- if (preg_match('/([^\s]+)$/', $line, $matches)) { // Remove whitespace and ensure that the active module symbol '*' doesn't get included.
- $branches[] = $matches[1];
- }
+ $branches[] = substr(trim($line), 52);
}
return $branches;
}

0 comments on commit c076d48

Please sign in to comment.