Example #1
0
File: git.php Project: rsms/gitblog
 static function commit($message, $author = null, $pathspec = null, $deferred = false)
 {
     # clear status cache
     self::$status_cache = null;
     if ($deferred && gb::defer(array('gb', 'commit'), $message, $author, $pathspec, false)) {
         $pathspec = $pathspec ? r($pathspec) : '';
         gb::log('deferred commit -m %s --author %s %s', escapeshellarg($message), escapeshellarg($author), $pathspec);
         if (!$pathspec) {
             gb::log(LOG_WARNING, 'deferred commits without pathspec might cause unexpected changesets');
         }
         return true;
     }
     if ($pathspec) {
         $pathspec = ' ' . self::escargs($pathspec);
     } else {
         $pathspec = '';
     }
     $author = $author ? '--author=' . escapeshellarg($author) : '';
     git::exec('commit -m ' . escapeshellarg($message) . ' --quiet ' . $author . ' -- ' . $pathspec);
     @chmod(gb::$site_dir . '/.git/COMMIT_EDITMSG', 0664);
     return true;
 }