From dfc4ece4083bbbb98f55291d05e7d2b1513464b7 Mon Sep 17 00:00:00 2001 From: Thomas Pummer <dev@nullpointer.at> Date: Fri, 22 Feb 2013 11:10:11 -0500 Subject: [PATCH] the display-name in web.xml now shows the actual version of Gitblit --- src/com/gitblit/utils/IssueUtils.java | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/com/gitblit/utils/IssueUtils.java b/src/com/gitblit/utils/IssueUtils.java index d0a0199..dd09235 100644 --- a/src/com/gitblit/utils/IssueUtils.java +++ b/src/com/gitblit/utils/IssueUtils.java @@ -28,12 +28,12 @@ import java.util.Set; import java.util.TreeSet; -import org.eclipse.jgit.JGitText; import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheEntry; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; @@ -76,9 +76,9 @@ public abstract boolean accept(IssueModel issue); } - public static final String GB_ISSUES = "refs/heads/gb-issues"; + public static final String GB_ISSUES = "refs/gitblit/issues"; - static final Logger LOGGER = LoggerFactory.getLogger(JGitUtils.class); + static final Logger LOGGER = LoggerFactory.getLogger(IssueUtils.class); /** * Log an error message and exception. @@ -111,7 +111,13 @@ * @return a refmodel for the gb-issues branch or null */ public static RefModel getIssuesBranch(Repository repository) { - return JGitUtils.getBranch(repository, "gb-issues"); + List<RefModel> refs = JGitUtils.getRefs(repository, com.gitblit.Constants.R_GITBLIT); + for (RefModel ref : refs) { + if (ref.reference.getName().equals(GB_ISSUES)) { + return ref; + } + } + return null; } /** @@ -374,7 +380,7 @@ String issuePath = getIssuePath(issueId); RevTree tree = JGitUtils.getCommit(repository, GB_ISSUES).getTree(); byte[] content = JGitUtils - .getByteContent(repository, tree, issuePath + "/" + attachment.id); + .getByteContent(repository, tree, issuePath + "/" + attachment.id, false); attachment.content = content; attachment.size = content.length; return attachment; @@ -394,7 +400,7 @@ public static IssueModel createIssue(Repository repository, Change change) { RefModel issuesBranch = getIssuesBranch(repository); if (issuesBranch == null) { - JGitUtils.createOrphanBranch(repository, "gb-issues", null); + JGitUtils.createOrphanBranch(repository, GB_ISSUES, null); } if (StringUtils.isEmpty(change.author)) { @@ -425,7 +431,7 @@ * Updates an issue in the gb-issues branch of the repository. * * @param repository - * @param issue + * @param issueId * @param change * @return true if successful */ @@ -471,7 +477,7 @@ RefModel issuesBranch = getIssuesBranch(repository); if (issuesBranch == null) { - throw new RuntimeException("gb-issues branch does not exist!"); + throw new RuntimeException(GB_ISSUES + " does not exist!"); } if (StringUtils.isEmpty(issueId)) { @@ -619,7 +625,7 @@ * distributed merging. * * @param repository - * @param issue + * @param issueId * @param change * @return true, if the change was committed */ @@ -740,7 +746,7 @@ * @param issueId * @return the root path of the issue content on the gb-issues branch */ - private static String getIssuePath(String issueId) { + static String getIssuePath(String issueId) { return issueId.substring(0, 2) + "/" + issueId.substring(2); } -- Gitblit v1.9.1