From 9a3d0f71a3a927c27fc62d06044f3716232c5056 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 18 Jan 2013 14:43:34 -0800 Subject: [PATCH] Decrease commit identifier display length Summary: We are running out of horizontal space, this should help a bit. Test Plan: Homepage, revision. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4518 --- .../view/DifferentialLocalCommitsView.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index dfb58dd3a8..9a47fe6f31 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -48,9 +48,9 @@ final class DifferentialLocalCommitsView extends AphrontView { $row = array(); if (idx($commit, 'commit')) { - $commit_hash = substr($commit['commit'], 0, 16); + $commit_hash = self::formatCommit($commit['commit']); } else if (isset($commit['rev'])) { - $commit_hash = substr($commit['rev'], 0, 16); + $commit_hash = self::formatCommit($commit['rev']); } else { $commit_hash = null; } @@ -58,7 +58,7 @@ final class DifferentialLocalCommitsView extends AphrontView { if ($has_tree) { $tree = idx($commit, 'tree'); - $tree = substr($tree, 0, 16); + $tree = self::formatCommit($tree); $row[] = phutil_tag('td', array(), $tree); } @@ -72,7 +72,7 @@ final class DifferentialLocalCommitsView extends AphrontView { if (is_array($parent)) { $parent = idx($parent, 'rev'); } - $parents[$k] = substr($parent, 0, 16); + $parents[$k] = self::formatCommit($parent); } $parents = phutil_implode_html(phutil_tag('br'), $parents); $row[] = phutil_tag('td', array(), $parents); @@ -141,4 +141,9 @@ final class DifferentialLocalCommitsView extends AphrontView { $headers, phutil_implode_html("\n", $rows)); } + + private static function formatCommit($commit) { + return substr($commit, 0, 12); + } + }