finding git on parent's dir
This commit is contained in:
parent
7aaf423fdb
commit
0d4a31b2a7
|
@ -988,13 +988,23 @@ if(!function_exists('output')){
|
|||
|
||||
|
||||
if(!function_exists('is_git_repo')){
|
||||
function is_git_repo($path){
|
||||
if(is_dir($path. DIRECTORY_SEPARATOR .".git")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
function is_git_repo(){
|
||||
return boolval( find_git_repo(dirname(__FILE__)) );
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('find_git_repo')){
|
||||
function find_git_repo($path){
|
||||
if(dirname($path) == DIRECTORY_SEPARATOR){
|
||||
return false;
|
||||
}else if( is_dir(getcwd().DIRECTORY_SEPARATOR.".git") ){
|
||||
return getcwd().DIRECTORY_SEPARATOR.".git";
|
||||
}else if(is_dir(dirname($path).DIRECTORY_SEPARATOR.".git")){
|
||||
return dirname($path).DIRECTORY_SEPARATOR.".git";
|
||||
}else{
|
||||
return find_git_repo(dirname($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue