From f8bb95d50ad925ab16a0a167bc553f036434a2d7 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 05 Jan 2013 15:04:40 -0500
Subject: [PATCH] Draft mechanism to record a push log as a hidden orphan branch

---
 src/com/gitblit/utils/IssueUtils.java |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/com/gitblit/utils/IssueUtils.java b/src/com/gitblit/utils/IssueUtils.java
index 7b24ccf..1b90c7d 100644
--- a/src/com/gitblit/utils/IssueUtils.java
+++ b/src/com/gitblit/utils/IssueUtils.java
@@ -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;
 	}
 
 	/**
@@ -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)) {
@@ -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)) {

--
Gitblit v1.9.1