Example #1
0
 /**
  * @param Repo $repo
  * @param int $page
  * @return array
  */
 public function commits(Repo $repo, $page = 1)
 {
     if (!$repo->isCloned()) {
         return [];
     }
     $result = [];
     foreach ($repo->commits()->paginate(null, $page)->toArray() as $commit) {
         $result[] = $commit + ['release' => $repo->releases()->where('commit', $commit['hash'])->first()];
     }
     return $result;
 }
Example #2
0
 /**
  * @param Repo $repo
  * @param int $page
  * @return array
  */
 public function branches(Repo $repo, $page = 1)
 {
     if (!$repo->isCloned()) {
         return [];
     }
     $result = ["master"];
     foreach ($repo->git()->getReferences() as $ref) {
         if ($ref instanceof Branch && $ref->getName() != "master") {
             $result[] = $ref->getName();
         }
     }
     return $result;
 }