예제 #1
0
     if (isset($_GET['path']) && isset($_GET['remote']) && isset($_GET['branch'])) {
         echo $git->pull(getWorkspacePath($_GET['path']), $_GET['remote'], $_GET['branch']);
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'rename':
     if (isset($_GET['path']) && isset($_GET['old_name']) && isset($_GET['new_name'])) {
         echo $git->renameItem(getWorkspacePath($_GET['path']), $_GET['old_name'], $_GET['new_name']);
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'numstat':
     if (isset($_GET['path'])) {
         $result = $git->numstat(getWorkspacePath($_GET['path']));
         if ($result !== false) {
             echo $result;
         } else {
             echo '{"status":"error","message":"Failed to get numstat"}';
         }
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'getSettings':
     if (isset($_GET['path'])) {
         $settings = $git->getSettings(getWorkspacePath($_GET['path']));
         echo '{"status":"success","data":' . json_encode($settings) . '}';
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';