]> source.dussan.org Git - gitblit.git/commitdiff
Fixed history of submodule reference if it was once a directory
authorJames Moger <james.moger@gitblit.com>
Fri, 3 May 2013 11:18:40 +0000 (07:18 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 3 May 2013 11:18:40 +0000 (07:18 -0400)
src/main/java/com/gitblit/wicket/panels/HistoryPanel.java

index e2b7e72304b1e631443f91518f87c5f725b7a962..49d8ae5f0eb55e740d8d782240609f9ae92483d3 100644 (file)
@@ -204,17 +204,23 @@ public class HistoryPanel extends BasePanel {
                                        item.add(links);\r
                                } else if (isSubmodule) {\r
                                        // submodule\r
-                                       item.add(new Label("hashLabel", submodulePath + "@"));\r
                                        Repository repository = GitBlit.self().getRepository(repositoryName);\r
                                        String submoduleId = JGitUtils.getSubmoduleCommitId(repository, path, entry);\r
                                        repository.close();\r
-                                       LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen),\r
-                                                       TreePage.class, WicketUtils.newObjectParameter(\r
-                                                                       submodulePath, submoduleId));\r
-                                       WicketUtils.setCssClass(commitHash, "shortsha1");\r
-                                       WicketUtils.setHtmlTooltip(commitHash, submoduleId);                                    \r
-                                       item.add(commitHash.setEnabled(hasSubmodule));\r
-                                       \r
+                                       if (StringUtils.isEmpty(submoduleId)) {\r
+                                               // not a submodule at this commit, just a matching path\r
+                                               item.add(new Label("hashLabel").setVisible(false));\r
+                                               item.add(new Label("hashLink").setVisible(false));\r
+                                       } else {\r
+                                               // really a submodule\r
+                                               item.add(new Label("hashLabel", submodulePath + "@"));\r
+                                               LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen),\r
+                                                               TreePage.class, WicketUtils.newObjectParameter(\r
+                                                                               submodulePath, submoduleId));\r
+                                               WicketUtils.setCssClass(commitHash, "shortsha1");\r
+                                               WicketUtils.setHtmlTooltip(commitHash, submoduleId);                                    \r
+                                               item.add(commitHash.setEnabled(hasSubmodule));\r
+                                       }\r
                                        Fragment links = new Fragment("historyLinks", "treeLinks", this);\r
                                        links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class,\r
                                                        WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r