Fix ref tagging
Fix ref tagging

--- a/include/defs.commands.php
+++ b/include/defs.commands.php
@@ -12,6 +12,7 @@
 define('GIT_LS_TREE','git-ls-tree');
 define('GIT_REV_LIST','git-rev-list');
 define('GIT_REV_PARSE','git-rev-parse');
+define('GIT_SHOW_REF','git-show-ref');
 define('GIT_TAR_TREE','git-tar-tree');
 
 ?>

--- a/include/gitutil.read_info_ref.php
+++ b/include/gitutil.read_info_ref.php
@@ -7,13 +7,17 @@
  *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
  */
 
+ include_once('defs.commands.php');
+
 function read_info_ref($project, $type = "")
 {
+	global $gitphp_conf;
 	$refs = array();
-	$lines = file($project);
+	$showrefs = shell_exec("env GIT_DIR=" . $project . " " . $gitphp_conf['gitbin'] . GIT_SHOW_REF . " --dereference");
+	$lines = explode("\n",$showrefs);
 	foreach ($lines as $no => $line) {
-		if (ereg("^([0-9a-fA-F]{40})\t.*" . $type . "/([^\^]+)",$line,$regs)) {
-			if ($isset($refs[$regs[1]]))
+		if (ereg("^([0-9a-fA-F]{40}) .*" . $type . "/([^\^]+)",$line,$regs)) {
+			if (isset($refs[$regs[1]]))
 				$refs[$regs[1]] .= " / " . $regs[2];
 			else
 				$refs[$regs[1]] = $regs[2];

comments