From a413ed7c41880cec3c224501dd2ed874fdbeef17 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 22 Nov 2015 14:53:36 -0500
Subject: [PATCH] Reset build identifiers for next point release cycle
---
src/main/java/com/gitblit/tickets/BranchTicketService.java | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/gitblit/tickets/BranchTicketService.java b/src/main/java/com/gitblit/tickets/BranchTicketService.java
index 0633751..8396693 100644
--- a/src/main/java/com/gitblit/tickets/BranchTicketService.java
+++ b/src/main/java/com/gitblit/tickets/BranchTicketService.java
@@ -30,9 +30,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.dircache.DirCache;
@@ -75,6 +72,8 @@
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* Implementation of a ticket service based on an orphan branch. All tickets
@@ -117,6 +116,7 @@
@Override
public BranchTicketService start() {
+ log.info("{} started", getClass().getSimpleName());
return this;
}
@@ -297,7 +297,7 @@
log.error("failed to read " + file, e);
} finally {
if (rw != null) {
- rw.release();
+ rw.close();
}
}
return null;
@@ -353,7 +353,7 @@
} catch (IOException e) {
log.error("", e);
} finally {
- inserter.release();
+ inserter.close();
}
}
@@ -712,7 +712,7 @@
} finally {
// release the treewalk
if (treeWalk != null) {
- treeWalk.release();
+ treeWalk.close();
}
}
} finally {
@@ -811,7 +811,7 @@
// finish the index
builder.finish();
} finally {
- inserter.release();
+ inserter.close();
}
return newIndex;
}
@@ -828,8 +828,12 @@
List<DirCacheEntry> list = new ArrayList<DirCacheEntry>();
TreeWalk tw = null;
try {
- tw = new TreeWalk(db);
ObjectId treeId = db.resolve(BRANCH + "^{tree}");
+ if (treeId == null) {
+ // branch does not exist yet, could be migrating tickets
+ return list;
+ }
+ tw = new TreeWalk(db);
int hIdx = tw.addTree(treeId);
tw.setRecursive(true);
@@ -851,7 +855,7 @@
}
} finally {
if (tw != null) {
- tw.release();
+ tw.close();
}
}
return list;
@@ -909,10 +913,10 @@
rc));
}
} finally {
- revWalk.release();
+ revWalk.close();
}
} finally {
- odi.release();
+ odi.close();
}
return success;
}
--
Gitblit v1.9.1