James Moger
2013-07-31 88ec32f91b3df15e063a2b2dcea3c90f3c65d835
src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
@@ -199,7 +199,16 @@
               return;
            }
            final String branch = entry.getName();
            boolean success = JGitUtils.deleteBranchRef(r, 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);
@@ -207,20 +216,17 @@
               // optionally update reflog
               if (RefLogUtils.hasRefLogBranch(r)) {
                  UserModel user = GitBlitWebSession.get().getUser();
                  success = RefLogUtils.deleteRef(user, r, branch);
                     RefLogUtils.deleteRef(user, r, ref);
               }
            }
            r.close();
            
            if (success) {
               info(MessageFormat.format("Branch \"{0}\" deleted", branch));
               // redirect to the owning page
               setResponsePage(getPage().getClass(), WicketUtils.newRepositoryParameter(repositoryModel.name));
            }
            else {
               } else {
               error(MessageFormat.format("Failed to delete branch \"{0}\"", branch));
            }
            }
            r.close();
            
            // redirect to the owning page
            PageParameters params = WicketUtils.newRepositoryParameter(repositoryModel.name);