From 245f5dc6a392b57de1cd1016856fa53032ce775f Mon Sep 17 00:00:00 2001 From: Chason Choate Date: Sun, 18 May 2014 00:20:03 -0500 Subject: [PATCH] Fixes #9. --- src/main/resources/js/commitgraph.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/resources/js/commitgraph.js b/src/main/resources/js/commitgraph.js index fa054af..211374d 100644 --- a/src/main/resources/js/commitgraph.js +++ b/src/main/resources/js/commitgraph.js @@ -86,6 +86,10 @@ }); return deferred.promise(); }; + CommitGraphVM.prototype.shortenName = function(name) { + if (name.length <= 25) return name; + return name.slice(0, 11) + '..' + name.slice(-11); + }; CommitGraphVM.prototype.buildGraph = function() { /* * node = [sha1, dotData, routeData, labelData] @@ -147,11 +151,11 @@ var labels = []; $.each(self.branches(), function(i, branch) { if (branch.latestChangeset === commit.id) - labels.push(branch.displayId); + labels.push(self.shortenName(branch.displayId)); }); $.each(self.tags(), function(i, tag) { if (tag.latestChangeset === commit.id) - labels.push(tag.displayId); + labels.push(self.shortenName(tag.displayId)); }); nodes.push([commit.id, [offset, branch], routes, labels]); });