Skip to content

Commit

Permalink
Update hash to use first 10 chars; Add additional commit information …
Browse files Browse the repository at this point in the history
…available to page template
  • Loading branch information
user996015 committed Mar 2, 2012
1 parent 452731b commit 3f9ce28
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions index.php
Expand Up @@ -205,7 +205,7 @@
$page['project'] = validate_project($_REQUEST['p']); $page['project'] = validate_project($_REQUEST['p']);
$page['title'] = "$page[project] - Commit - ViewGit"; $page['title'] = "$page[project] - Commit - ViewGit";
$page['commit_id'] = validate_hash($_REQUEST['h']); $page['commit_id'] = validate_hash($_REQUEST['h']);
$page['subtitle'] = "Commit ". substr($page['commit_id'], 0, 6); $page['subtitle'] = "Commit ". substr($page['commit_id'], 0, 10);


$info = git_get_commit_info($page['project'], $page['commit_id']); $info = git_get_commit_info($page['project'], $page['commit_id']);


Expand Down Expand Up @@ -237,7 +237,7 @@
$page['title'] = "$page[project] - Commitdiff - ViewGit"; $page['title'] = "$page[project] - Commitdiff - ViewGit";
$hash = validate_hash($_REQUEST['h']); $hash = validate_hash($_REQUEST['h']);
$page['commit_id'] = $hash; $page['commit_id'] = $hash;
$page['subtitle'] = "Commitdiff ". substr($page['commit_id'], 0, 6); $page['subtitle'] = "Commitdiff ". substr($page['commit_id'], 0, 10);


$info = git_get_commit_info($page['project'], $hash); $info = git_get_commit_info($page['project'], $hash);


Expand All @@ -258,7 +258,7 @@
elseif ($action === 'patch') { elseif ($action === 'patch') {
$project = validate_project($_REQUEST['p']); $project = validate_project($_REQUEST['p']);
$hash = validate_hash($_REQUEST['h']); $hash = validate_hash($_REQUEST['h']);
$filename = "$project-". substr($hash, 0, 7) .".patch"; $filename = "$project-". substr($hash, 0, 10) .".patch";


//header("Content-Type: text/x-diff"); //header("Content-Type: text/x-diff");
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
Expand Down Expand Up @@ -439,15 +439,21 @@
*/ */
$page['title'] = "$page[project] - Files - ViewGit"; $page['title'] = "$page[project] - Files - ViewGit";


// 'hb' optionally contains the commit_id this tree is related to // 'hb' optionally contains the commit_id this tree is related to
if (isset($_REQUEST['hb'])) { if (isset($_REQUEST['hb'])) {
$page['commit_id'] = validate_hash($_REQUEST['hb']); $page['commit_id'] = validate_hash($_REQUEST['hb']);
} $info = git_get_commit_info($page['project'], $page['commit_id']);
else { }
// for the header else {
$info = git_get_commit_info($page['project']); $info = git_get_commit_info($page['project']);
$page['commit_id'] = $info['h']; }
}
// for the header
$page['commit_id'] = $info['h'];
$page['message_firstline'] = $info['message_firstline'];
$page['author_name'] = $info['author_name'];
$page['author_datetime'] = $info['author_datetime'];
$page['hash'] = substr($page['commit_id'], 0, 10);


$page['path'] = ''; $page['path'] = '';
if (isset($_REQUEST['f'])) { if (isset($_REQUEST['f'])) {
Expand Down Expand Up @@ -485,7 +491,7 @@
else { else {
$page['commit_id'] = 'HEAD'; $page['commit_id'] = 'HEAD';
} }
$page['subtitle'] = "Blob ". substr($page['hash'], 0, 6); $page['subtitle'] = "Blob ". substr($page['hash'], 0, 10);


$page['path'] = ''; $page['path'] = '';
if (isset($_REQUEST['f'])) { if (isset($_REQUEST['f'])) {
Expand Down

0 comments on commit 3f9ce28

Please sign in to comment.