From d095e4c3ff9a2d2970fe0d0694d99c57381c4f44 Mon Sep 17 00:00:00 2001 From: Eoin Mcloughlin Date: Mon, 24 May 2010 20:23:32 +0100 Subject: [PATCH] Show list of affected files in commit view. With links to viewblob for relevant revision. Layout for affected files copied from commitdiff. [hoxu@users.sf.net: whitespace changes] Signed-off-by: Heikki Hokkanen --- inc/functions.php | 15 +++++++++++++++ index.php | 1 + templates/commit.php | 21 ++++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index ff7f0d4..809f6fa 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -180,6 +180,21 @@ function git_get_commit_info($project, $hash = 'HEAD', $path = null) $info['committer_datetime'] = gmstrftime($conf['datetime_full'], $info['committer_utcstamp']); $info['committer_datetime_local'] = gmstrftime($conf['datetime_full'], $info['committer_stamp']) .' '. $info['committer_timezone']; + $info['affected_files'] = array(); + $affected_files = run_git($project, "show --pretty=\"format:\" --name-only $hash"); + foreach ($affected_files as $file ) { + // The format above contains a blank line; Skip it. + if ($file == '') { + continue; + } + + $output = run_git($project, "ls-tree $hash $file"); + foreach ($output as $line) { + $parts = preg_split('/\s+/', $line, 4); + $info['affected_files'][] = array('name' => $parts[3], 'hash' => $parts[2]); + } + } + return $info; } diff --git a/index.php b/index.php index 13de554..394ce35 100644 --- a/index.php +++ b/index.php @@ -198,6 +198,7 @@ elseif ($action === 'commit') { $page['message'] = $info['message']; $page['message_firstline'] = $info['message_firstline']; $page['message_full'] = $info['message_full']; + $page['affected_files'] = $info['affected_files']; } diff --git a/templates/commit.php b/templates/commit.php index 184a508..4160a09 100644 --- a/templates/commit.php +++ b/templates/commit.php @@ -47,5 +47,24 @@ foreach ($page['parents'] as $parent) {
- +
+ + + + + + + + +"; +} +?> + + +
Affected files:
"; + echo " 'viewblob', 'p' => $page['project'], 'h' => $details['hash'] ) ) . "\">$details[name]
"; + echo "
+
-- 2.11.4.GIT