Ejemplo n.º 1
0
 function testMultipleCommitsInSinglePush()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
     $Git = new Git($this->__repos[1]);
     $this->assertTrue($Git->create());
     $this->assertTrue(file_exists(TMP . 'tests/git/repo/test.git'));
     $this->assertTrue(file_exists(TMP . 'tests/git/working/test/master/.git'));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new');
     $Git->commit(array("-m", "'Pushing to fork'"));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new again');
     $Git->commit(array("-m", "'Pushing to fork again'"));
     $Git->push('origin', 'master');
     $data = $Git->read();
     $this->assertTrue($data['message'], 'Pushing to fork again');
     $this->assertTrue(file_exists(TMP . 'tests/git/working/test/new.text'));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new again');
     $Git->commit(array("-m", "'Pushing to fork again again'"));
     $Git->push('origin', 'master');
     $data = $Git->read();
     $this->assertTrue($data['message'], 'Pushing to fork again again');
     //pr($Git->run('log', array('--pretty=oneline')));
     //$info = $Git->run('log', array("--pretty=format:%P%x00%H%x00%an%x00%ai%x00%s"), 'capture');
     //list($parent, $revision, $author, $commit_date, $message) = explode(chr(0), $info[0]);
     //pr($Git->run('rev-list', array($parent, $revision)));
     //pr($Git->run('log', array($revision, "--pretty=format:%P%x00%H%x00%an%x00%ai%x00%s"), 'capture'));
     //pr($Git->debug);
 }