From cbe6840efecf87e53a687cdce6fbdf84c6ab8a46 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 19 Sep 2013 08:40:59 -0400
Subject: [PATCH] Documentation
---
src/main/java/com/gitblit/wicket/panels/BranchesPanel.java | 42 ++++++++++++++++++++++++------------------
1 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
index 85d0029..dba4089 100644
--- a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
@@ -199,28 +199,34 @@
return;
}
final String branch = entry.getName();
- boolean success = JGitUtils.deleteBranchRef(r, branch);
- if (success) {
- // clear commit cache
- CommitCache.instance().clear(repositoryModel.name, branch);
+ Ref ref = null;
+ try {
+ ref = r.getRef(branch);
+ if (ref == null && !branch.startsWith(Constants.R_HEADS)) {
+ ref = r.getRef(Constants.R_HEADS + branch);
+ }
+ } catch (IOException e) {
+ }
+ if (ref != null) {
+ boolean success = JGitUtils.deleteBranchRef(r, ref.getName());
+ if (success) {
+ // clear commit cache
+ CommitCache.instance().clear(repositoryModel.name, branch);
+
+ // optionally update reflog
+ if (RefLogUtils.hasRefLogBranch(r)) {
+ UserModel user = GitBlitWebSession.get().getUser();
+ RefLogUtils.deleteRef(user, r, ref);
+ }
+ }
- // optionally update reflog
- if (RefLogUtils.hasRefLogBranch(r)) {
- UserModel user = GitBlitWebSession.get().getUser();
- success = RefLogUtils.deleteRef(user, r, branch);
+ if (success) {
+ info(MessageFormat.format("Branch \"{0}\" deleted", branch));
+ } else {
+ error(MessageFormat.format("Failed to delete branch \"{0}\"", branch));
}
}
-
r.close();
-
- if (success) {
- info(MessageFormat.format("Branch \"{0}\" deleted", branch));
- // redirect to the owning page
- setResponsePage(getPage().getClass(), WicketUtils.newRepositoryParameter(repositoryModel.name));
- }
- else {
- error(MessageFormat.format("Failed to delete branch \"{0}\"", branch));
- }
// redirect to the owning page
PageParameters params = WicketUtils.newRepositoryParameter(repositoryModel.name);
--
Gitblit v1.9.1