status() static public method

git status
static public status ( $raw = false, $cached = true ) : array
return array array( 'branch' => 'master', ['upstream' => array('name' => 'origin/master', 'distance' => 24),] ['staged' => array( 'filename' => array('status'=>'added'|'modified'|'deleted') | array('status'=>'renamed','newname'=>'filename') ], ... ),] ['unstaged' => array( 'filename' => array('status'=>'added'|'modified'|'deleted') | array('status'=>'renamed','newname'=>'filename') ], ... ),] ['untracked' => array( 'filename' => 1, ... )] )
Example #1
0
 /** True if there are local, uncommitted modifications */
 function isDirty()
 {
     if (!$this->isTracked()) {
         return true;
     }
     $st = git::status();
     return isset($st['staged'][$this->name]) || isset($st['unstaged'][$this->name]);
 }
Example #2
0
gb::$title[] = 'Posts';
include '../_header.php';
$muxed_posts = array();
class st
{
    const STAGED = 't';
    const UNSTAGED = 'c';
    const UNTRACKED = 'u';
    const DRAFT = 'd';
    const SCHEDULED = 's';
    const MODIFIED = 'm';
    const REMOVED = 'r';
    const RENAMED = 'e';
    const ADDED = 'a';
}
$st = git::status();
function _mkflags($post, $status = '')
{
    $flags = '';
    if ($post->draft) {
        $flags .= st::DRAFT;
    }
    switch ($status) {
        # added'|'modified'|'deleted renamed
        case 'added':
            $flags .= st::ADDED;
            break;
        case 'modified':
            $flags .= st::MODIFIED;
            break;
        case 'deleted':