From ffcf6081acf66767133fa93ca98c8ab5f479faf0 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Sat, 14 Jul 2012 16:45:33 -0300 Subject: [PATCH] Starting to use Symfony Filesystem component, fixing broken tar/zip download --- lib/Git/Repository.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Git/Repository.php b/lib/Git/Repository.php index 938cec2..f7f2e44 100644 --- a/lib/Git/Repository.php +++ b/lib/Git/Repository.php @@ -6,6 +6,7 @@ use Git\Commit\Commit; use Git\Model\Tree; use Git\Model\Blob; use Git\Model\Diff; +use Symfony\Component\Filesystem\Filesystem; class Repository { @@ -489,7 +490,7 @@ class Repository */ public function getBranchTree($branch) { - $hash = $this->getClient()->run($this, "log --pretty='%T' --max-count=1 $refspec"); + $hash = $this->getClient()->run($this, "log --pretty='%T' --max-count=1 $branch"); $hash = trim($hash, "\r\n "); return $hash ? : false; @@ -504,10 +505,8 @@ class Repository */ public function createArchive($tree, $output, $format = 'zip') { - if (!file_exists($dir = dirname($output)) && !@mkdir($dir, 0777, true)) { - throw new \RuntimeException("Unable to create directory $dir"); - } - + $fs = new Filesystem; + $fs->mkdir(dirname($output)); $this->getClient()->run($this, "archive --format=$format --output=$output $tree"); }