コード例 #1
0
ファイル: index.php プロジェクト: surikat/git-cascade
                 }
             }
         }
         closedir($dh);
     }
 };
 $remote = isset($_POST['remote']) && $_POST['remote'] ? $_POST['remote'] : $default['remote'];
 $branch = isset($_POST['branch']) && $_POST['branch'] ? $_POST['branch'] : $default['branch'];
 if ($_POST['pull_push'] == 'pull') {
     $repo->pull($remote, $branch);
     if ($pull_push_recursive) {
         $recursiveGit($repository, 'pull', [$remote, $branch], 'pull');
     }
 } elseif ($_POST['pull_push'] == 'push') {
     if (is_dir($currentGitDir . '/extras')) {
         $lrepo = new GitRepo($currentGitDir . '/extras', $currentGitDir);
         $lrepo->run('add --ignore-removal .');
         $lrepo->run('commit -m "update extras"');
         $logs = array_merge($logs, $lrepo->getLogs());
     }
     if ($github) {
         $pushUrl = 'https://' . $github['token'] . '@github.com/' . $githubUser . '/' . $githubRepo . '.git';
         $repo->run('push --tags ' . escapeshellarg($pushUrl) . ' --repo=' . escapeshellarg($remote) . ' ' . escapeshellarg($branch));
         if ($pull_push_recursive) {
             $recursiveGit($repository, function ($lrepo, $args) use($github, $githubUserRepo) {
                 list($remote, $branch) = $args;
                 list($githubUser, $githubRepo) = $githubUserRepo($lrepo->git_directory_path());
                 $pushUrl = 'https://' . $github['token'] . '@github.com/' . $githubUser . '/' . $githubRepo . '.git';
                 $lrepo->run('push --tags ' . escapeshellarg($pushUrl) . ' --repo=' . escapeshellarg($remote) . ' ' . escapeshellarg($branch));
             }, [$remote, $branch], 'push');
         }
コード例 #2
0
ファイル: diff.php プロジェクト: surikat/git-cascade
<?php

if (!isset($_POST['file']) || !$_POST['file'] || !isset($_POST['repository']) || !$_POST['repository']) {
    return;
}
require_once __DIR__ . '/php/common.inc.php';
use Surikat\GitCascade\GitRepo;
use Surikat\GitCascade\AnsiToHtmlConverter;
use Surikat\GitCascade\AnsiToHtmlTheme;
$file = $_POST['file'];
$repository = $_POST['repository'];
$gitdir = isset($_POST['gitdir']) ? rtrim($_POST['gitdir'], '/') : null;
$repo = new GitRepo($repository, $gitdir);
$diff = $repo->run('diff --color-words -- ' . escapeshellarg($file));
$theme = new AnsiToHtmlTheme();
$converter = new AnsiToHtmlConverter($theme, false);
$diff = $converter->convert($diff);
$styles = $theme->asCss();
?>
<style><?php 
echo $styles;
?>
</style>
<pre class="ansi_color_bg_black ansi_color_fg_white"><?php 
echo $diff;
?>
</pre>