change snapshot function
[gitweb.git] / git_version.php
1 <?php
2 if($_GET["git"]){
3 $hash = shell_exec("git --git-dir=/home/git/".$_GET["git"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
4 $con= shell_exec('git --git-dir=/home/git/'.$_GET["git"].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
5 if(!$hash){
6 echo "git-0-0";
7 }else{
8 echo "git-".substr($con, 0, -1)."-".substr($hash, 0, -1);
9 }
10 }else{
11 echo "404 - No such project";
12 }
13 ?>