From bb33116dccbd30eba6e4265ba08be909439874d9 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 3 May 2013 07:18:40 -0400 Subject: Fixed history of submodule reference if it was once a directory --- .../com/gitblit/wicket/panels/HistoryPanel.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java index e2b7e723..49d8ae5f 100644 --- a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java @@ -204,17 +204,23 @@ public class HistoryPanel extends BasePanel { item.add(links); } else if (isSubmodule) { // submodule - item.add(new Label("hashLabel", submodulePath + "@")); Repository repository = GitBlit.self().getRepository(repositoryName); String submoduleId = JGitUtils.getSubmoduleCommitId(repository, path, entry); repository.close(); - LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen), - TreePage.class, WicketUtils.newObjectParameter( - submodulePath, submoduleId)); - WicketUtils.setCssClass(commitHash, "shortsha1"); - WicketUtils.setHtmlTooltip(commitHash, submoduleId); - item.add(commitHash.setEnabled(hasSubmodule)); - + if (StringUtils.isEmpty(submoduleId)) { + // not a submodule at this commit, just a matching path + item.add(new Label("hashLabel").setVisible(false)); + item.add(new Label("hashLink").setVisible(false)); + } else { + // really a submodule + item.add(new Label("hashLabel", submodulePath + "@")); + LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen), + TreePage.class, WicketUtils.newObjectParameter( + submodulePath, submoduleId)); + WicketUtils.setCssClass(commitHash, "shortsha1"); + WicketUtils.setHtmlTooltip(commitHash, submoduleId); + item.add(commitHash.setEnabled(hasSubmodule)); + } Fragment links = new Fragment("historyLinks", "treeLinks", this); links.add(new BookmarkablePageLink("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()))); -- cgit v1.2.3