Cache expiration isn't an error
[gitphp.git] / include / display.git_blobdiff.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
 *  display.git_blobdiff.php
 *  gitphp: A PHP git repository browser
 *  Component: Display - blob diff
 *
 *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
 */
 
 require_once('util.prep_tmpdir.php');
 require_once('gitutil.git_read_commit.php');
 require_once('gitutil.read_info_ref.php');
 require_once('gitutil.git_path_trees.php');
 require_once('gitutil.git_diff.php');
 
function git_blobdiff($projectroot,$project,$hash,$hashbase,$hashparent,$file)
{
        global $tpl;
        $ret = prep_tmpdir();
        if ($ret !== TRUE) {
                echo $ret;
                return;
        }
        $tpl->clear_all_assign();
        $tpl->assign("hash",$hash);
        $tpl->assign("hashparent",$hashparent);
        $tpl->assign("hashbase",$hashbase);
        $tpl->assign("project",$project);
        if (isset($file))
                $tpl->assign("file",$file);
        if ($co = git_read_commit($projectroot . $project, $hashbase)) {
                $tpl->assign("fullnav",TRUE);
                $tpl->assign("tree",$co['tree']);
                $tpl->assign("title",$co['title']);
                $refs = read_info_ref($projectroot . $project);
                if (isset($refs[$hashbase]))
                        $tpl->assign("hashbaseref",$refs[$hashbase]);
        }
        $paths = git_path_trees($projectroot . $project, $hashbase, $file);
        $tpl->assign("paths",$paths);
        $diffout = explode("\n",git_diff($projectroot . $project, $hashparent,($file?$file:$hashparent),$hash,($file?$file:$hash)));
        $tpl->assign("diff",$diffout);
        $tpl->display("blobdiff.tpl");
}
 
?>
 
comments