James Moger
2012-12-03 e5662e85681deb98e2ed65831ade3f066f29f154
Support symlink display in tree and commit pages (issue-171)
4 files modified
33 ■■■■ changed files
docs/04_releases.mkd 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/models/PathModel.java 4 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitPage.java 10 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TreePage.java 18 ●●●●● patch | view | raw | blame | history
docs/04_releases.mkd
@@ -73,6 +73,7 @@
#### changes
- Added support for symlinks in tree page and commit page (issue 171)
- All access restricted servlets (e.g. DownloadZip, RSS, etc) will try to authenticate using X509 certificates, container principals, cookies, and BASIC headers, in that order.
- Added *groovy* and *scala* to *web.prettyPrintExtensions*
- Added short commit id column to log and history tables (issue 168)
src/com/gitblit/models/PathModel.java
@@ -48,6 +48,10 @@
        this.commitId = commitId;
    }
    public boolean isSymlink() {
        return FileMode.SYMLINK.equals(mode);
    }
    public boolean isSubmodule() {
        return FileMode.GITLINK.equals(mode);
    }
src/com/gitblit/wicket/pages/CommitPage.java
@@ -169,9 +169,15 @@
                            WicketUtils.newPathParameter(submodulePath, submoduleId, "")).setEnabled(hasSubmodule));
                } else {
                    // blob
                    item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class,
                    String displayPath = entry.path;
                    String path = entry.path;
                    if (entry.isSymlink()) {
                        path = JGitUtils.getStringContent(getRepository(), getCommit().getTree(), path);
                        displayPath = entry.path + " -> " + path;
                    }
                    item.add(new LinkPanel("pathName", "list", displayPath, BlobPage.class,
                            WicketUtils
                                    .newPathParameter(repositoryName, entry.commitId, entry.path)));
                                    .newPathParameter(repositoryName, entry.commitId, path)));
                }
                
                // quick links
src/com/gitblit/wicket/pages/TreePage.java
@@ -144,25 +144,31 @@
                        item.add(links);                        
                    } else {
                        // blob link
                        String displayPath = entry.path;
                        String path = entry.path;
                        if (entry.isSymlink()) {
                            path = JGitUtils.getStringContent(getRepository(), getCommit().getTree(), path);
                            displayPath = entry.path + " -> " + path;
                        }
                        item.add(WicketUtils.getFileImage("pathIcon", entry.name));
                        item.add(new Label("pathSize", byteFormat.format(entry.size)));
                        item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class,
                        item.add(new LinkPanel("pathName", "list", displayPath, BlobPage.class,
                                WicketUtils.newPathParameter(repositoryName, entry.commitId,
                                        entry.path)));
                                        path)));
                        // links
                        Fragment links = new Fragment("pathLinks", "blobLinks", this);
                        links.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
                                WicketUtils.newPathParameter(repositoryName, entry.commitId,
                                        entry.path)));
                                        path)));
                        links.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
                                .newPathParameter(repositoryName, entry.commitId, entry.path)));
                                .newPathParameter(repositoryName, entry.commitId, path)));
                        links.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
                                WicketUtils.newPathParameter(repositoryName, entry.commitId,
                                        entry.path)));
                                        path)));
                        links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
                                WicketUtils.newPathParameter(repositoryName, entry.commitId,
                                        entry.path)));
                                        path)));
                        item.add(links);
                    }
                }