Skip to content

Commit 70f1f40

Browse files
committed
Merge pull request kbjr#21 from mAAdhaTTah/master
git status + bugfix
2 parents 6e2d901 + cd14e83 commit 70f1f40

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Git.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ public function set_repo_path($repo_path, $create_new = false, $_init = true) {
169169
$this->bare = false;
170170
// Is this a bare repo?
171171
} else if (is_file($repo_path."/config")) {
172-
if (parse_ini_file($repo_path."/config")['bare']) {
172+
$parse_ini = parse_ini_file($repo_path."/config");
173+
if ($parse_ini['bare']) {
173174
$this->repo_path = $repo_path;
174175
$this->bare = true;
175176
}
@@ -287,6 +288,23 @@ public function run($command) {
287288
return $this->run_command(Git::get_bin()." ".$command);
288289
}
289290

291+
/**
292+
* Runs a 'git status' call
293+
*
294+
* Accept a convert to HTML bool
295+
*
296+
* @access public
297+
* @param bool return string with <br />
298+
* @return string
299+
*/
300+
public function status($html = false) {
301+
$msg = $this->run("status");
302+
if ($html == true) {
303+
$msg = str_replace("\n", "<br />", $msg);
304+
}
305+
return $msg;
306+
}
307+
290308
/**
291309
* Runs a `git add` call
292310
*
@@ -365,10 +383,11 @@ public function clone_remote($source) {
365383
*
366384
* @access public
367385
* @param bool delete directories?
386+
* @param bool force clean?
368387
* @return string
369388
*/
370-
public function clean($dirs = false) {
371-
return $this->run("clean".(($dirs) ? " -d" : ""));
389+
public function clean($dirs = false, $force = false) {
390+
return $this->run("clean".(($force) ? " -f" : "").(($dirs) ? " -d" : ""));
372391
}
373392

374393
/**

0 commit comments

Comments
 (0)