Changed all ereg references to preg_match("/regex/"... and eregi references to preg_match("/regex/i" to prevent php 5.3.0 from complaining
[gitphp.git] / include / gitutil.read_info_ref.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
 *  gitutil.read_info_ref.php
 *  gitphp: A PHP git repository browser
 *  Component: Git utility - read info on a ref
 *
 *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
 */
 
 require_once('defs.commands.php');
 require_once('gitutil.git_exec.php');
 
function read_info_ref($project, $type = "")
{
        $refs = array();
        $cmd = GIT_SHOW_REF . " --dereference";
        $showrefs = git_exec($project, $cmd);
        $lines = explode("\n",$showrefs);
        foreach ($lines as $no => $line) {
                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];
                }
        }
        return $refs;
}
 
?>
 
comments