BarryServer : Git

All the code for all my projects
// BarryServer : Git / barryserver-git / commit / 96e89f1fc036dd10233465726be77ec16866e5ba

// Related

barryserver-git

Barry Fixed issue with file names being displayed fully + Fixed spelling mistake 96e89f1 (4 years, 4 months ago)
diff --git a/git.php b/git.php
index 37188f5..0b472aa 100644
--- a/git.php
+++ b/git.php
@@ -194,8 +194,10 @@ $FOOTER = "BarryServer Git Browser";
 			echo "		<span class=\"error\">\n			<b>404! Repository not found!</b><br>\n";
 			echo "			[<a href=\"".$ROOT.$SCRIPT."/\">RETURN</a>]\n		</span>\n";
 		} else {
-			echo "		<span class=\"clone\">git clone <a href=\"git://".$_SERVER["SERVER_NAME"]."/".$repo.".git\">git://".$_SERVER["SERVER_NAME"]."/".$repo.".git</a></span><br><br>\n";
 			$branch = explode("/", substr($path,1))[1];
+			echo "		<span class=\"clone\">git clone ";
+			if ($branch !== $BRANCH) {echo "-b ".$branch." ";}
+			echo "<a href=\"git://".$_SERVER["SERVER_NAME"]."/".$repo.".git\">git://".$_SERVER["SERVER_NAME"]."/".$repo.".git</a></span><br><br>\n";
 			$rest = implode("/",array_slice(explode("/", substr($path,1)),2));
 			chdir($ORIGINAL."/".$repo.".git");
 			if (!isset($branch)) {header("Location: ".$ROOT.$SCRIPT."/".$repo."/");}
@@ -227,10 +229,10 @@ $FOOTER = "BarryServer Git Browser";
 					foreach (explode("\n",$files) as $file) {
 						$name = explode(" ",$file);
 						if ($name[1] == "tree") {
-							$folderstxt .= "		<a href=\"".$ROOT.$SCRIPT."/".$repo."/".$branch."/".explode("\t",$name[2])[1]."/\" class=\"folder\">".explode("\t",$name[2])[1]."</a><br>\n";
+							$folderstxt .= "		<a href=\"".$ROOT.$SCRIPT."/".$repo."/".$branch."/".explode("\t",$name[2])[1]."/\" class=\"folder\">".end(explode("/",explode("\t",$name[2])[1]))."</a><br>\n";
 						}
 						if ($name[1] == "blob") {
-							$filestxt .= "		<a href=\"".$ROOT.$SCRIPT."/".$repo."/".$branch."/".explode("\t",$name[2])[1]."\" class=\"file\">".explode("\t",$name[2])[1]."</a><br>\n";
+							$filestxt .= "		<a href=\"".$ROOT.$SCRIPT."/".$repo."/".$branch."/".explode("\t",$name[2])[1]."\" class=\"file\">".end(explode("/",explode("\t",$name[2])[1]))."</a><br>\n";
 						}
 					}
 					echo $folderstxt;
@@ -259,7 +261,7 @@ $FOOTER = "BarryServer Git Browser";
 						$content = shell_exec("git cat-file -p ".explode("\t",explode(" ",explode("\n",$files)[0])[2])[0]);
 						echo "<pre>\n".htmlspecialchars($content)."</pre>\n";
 					} else {
-						echo "		<span class=\"errer\">\n		<b>404! File not found!</b><br>\n";
+						echo "		<span class=\"error\">\n		<b>404! File not found!</b><br>\n";
 						echo "			[<a href=\"".$ROOT.$SCRIPT."/".$repo."/".$branch."\">RETURN</a>]\n		</span>\n";
 					}
 				}