From 035160efea1f21b8935848f7a68f8616c76206f6 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 6 Jan 2009 00:47:32 -0700 Subject: [PATCH] Fix a couple of VCS/git issues --- framework/Vcs/lib/Horde/Vcs/Git.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index b8f0d1603..aaf418f6b 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -35,6 +35,14 @@ class Horde_Vcs_git extends Horde_Vcs return $this->getPath('git') . ' --git-dir=' . $this->_sourceroot; } + public function getCheckout($file, $rev) + { + if (!isset($this->_cache['co'])) { + $this->_cache['co'] = new 'Horde_Vcs_Checkout_git'; + } + return $this->_cache['co']->get($this, $file->queryModulePath(), $rev); + } + } /** @@ -136,7 +144,9 @@ class Horde_Vcs_Checkout_git extends Horde_Vcs_Checkout { $rep->assertValidRevision($rev); - return ($pipe = popen($rep->getCommand() . ' cat-file blob ' . $file->getHashForRevision($rev) . ' 2>&1', VC_WINDOWS ? 'rb' : 'r')) + $file_ob = $rep->getFileObject($file); + + return ($pipe = popen($rep->getCommand() . ' cat-file blob ' . $file_ob->getHashForRevision($rev) . ' 2>&1', VC_WINDOWS ? 'rb' : 'r')) ? $pipe : PEAR::raiseError('Couldn\'t perform checkout of the requested file'); } @@ -389,6 +399,16 @@ class Horde_Vcs_File_git extends Horde_Vcs_File } } + /** + * Return the name of this file relative to its sourceroot. + * + * @return string Pathname relative to the sourceroot. + */ + public function queryModulePath() + { + return $this->name; + } + } /** -- 2.11.0