Skip to content

Commit 1080ec5

Browse files
committed
short the old/new links
1 parent 297afd3 commit 1080ec5

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

opengrok-web/src/main/java/org/opengrok/web/DiffData.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2009, 2011, Jens Elkner.
22-
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
22+
* Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved.
2323
* Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
2424
*/
2525
package org.opengrok.web;
@@ -91,6 +91,14 @@ public String getRev(int index) {
9191
return rev[index];
9292
}
9393

94+
/**
95+
* @param index index of the revision
96+
* @return shortened revision string (maximum 8 characters) with ".." appended
97+
*/
98+
public String getShortRev(int index) {
99+
return rev[index].substring(0, Integer.min(rev[index].length(), 8)) + "..";
100+
}
101+
94102
public String[] getFile(int index) {
95103
return file[index];
96104
}

opengrok-web/src/main/webapp/diff.jsp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1616
1717
CDDL HEADER END
1818
19-
Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
19+
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
2020
Portions Copyright 2011 Jens Elkner.
2121
Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
2222
--%>
@@ -163,9 +163,9 @@ include file="/mast.jsp"
163163
if (type == t) {
164164
%> <span class="active"><%= t.toString() %><%
165165
if (t == DiffType.OLD) {
166-
%> ( <%= data.getRev(0) %> )<%
166+
%> (<%= data.getRev(0) %>)<%
167167
} else if (t == DiffType.NEW) {
168-
%> ( <%= data.getRev(1) %> )<%
168+
%> (<%= data.getRev(1) %>)<%
169169
}
170170
%></span><%
171171
} else {
@@ -175,9 +175,9 @@ include file="/mast.jsp"
175175
<%= QueryParameters.DIFF_LEVEL_PARAM_EQ %><%= full ? '1' : '0'%>"><%= t.toString() %>
176176
<%
177177
if (t == DiffType.OLD) {
178-
%> ( <%= data.getRev(0) %> )<%
178+
%> (<%= data.getShortRev(0) %>)<%
179179
} else if (t == DiffType.NEW) {
180-
%> ( <%= data.getRev(1) %> )<%
180+
%> (<%= data.getShortRev(1) %>)<%
181181
}
182182
%></a></span><%
183183
}

0 commit comments

Comments
 (0)