From a8e4d9cb3a8977ee737a560f1d20f6f3413bba08 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 12 Jun 2009 21:54:52 -0400 Subject: [PATCH] add a crude way of returning the default branch and make sure it is selected even if it's not first alphabetically --- chora/browsedir.php | 4 ++++ framework/Vcs/lib/Horde/Vcs/Cvs.php | 5 +++++ framework/Vcs/lib/Horde/Vcs/Git.php | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/chora/browsedir.php b/chora/browsedir.php index 9bb132a84..610ad512f 100644 --- a/chora/browsedir.php +++ b/chora/browsedir.php @@ -55,8 +55,12 @@ foreach ($umap as $key => $val) { $url[$key] = Chora::url('browsedir', $where . '/', $arg); } +$branches = array(); if ($VC->hasFeature('branches')) { $branches = $dir->getBranches(); + if ($rev === null) { + $rev = $dir->getDefaultBranch(); + } } /* Print out the directory header. */ diff --git a/framework/Vcs/lib/Horde/Vcs/Cvs.php b/framework/Vcs/lib/Horde/Vcs/Cvs.php index 3d051d3f0..3ead7a116 100644 --- a/framework/Vcs/lib/Horde/Vcs/Cvs.php +++ b/framework/Vcs/lib/Horde/Vcs/Cvs.php @@ -334,6 +334,11 @@ class Horde_Vcs_Directory_Cvs extends Horde_Vcs_Directory return array('HEAD'); } + public function getDefaultBranch() + { + return 'HEAD'; + } + } /** diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index 46af74ca1..655acdb87 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -349,6 +349,14 @@ class Horde_Vcs_Directory_Git extends Horde_Vcs_Directory return array_keys($this->_rep->getBranchList()); } + /** + * @TODO ? + */ + public function getDefaultBranch() + { + return 'master'; + } + } /** -- 2.11.0