Start on snip history manipulation
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\Snip;
|
||||
use App\Git\CustomGit;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
||||
class SnipServiceFactory
|
||||
@ -17,6 +18,13 @@ class SnipServiceFactory
|
||||
|
||||
public function create(Snip $snip): SnipService
|
||||
{
|
||||
return new SnipService($snip, $this->snipBasePath, $this->security->getUser());
|
||||
$git = new CustomGit();
|
||||
$repoPath = sprintf('%s/%s', $this->snipBasePath, $snip->getId());
|
||||
if (!is_dir($repoPath)) {
|
||||
$repo = $git->init($repoPath);
|
||||
} else {
|
||||
$repo = $git->open($repoPath);
|
||||
}
|
||||
return new SnipService($repo, $this->security->getUser());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user