]> source.dussan.org Git - gitblit.git/commitdiff
Improve ticket branch ref deletion push handling
authorJames Moger <james.moger@gitblit.com>
Mon, 14 Apr 2014 19:07:23 +0000 (15:07 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 14 Apr 2014 19:07:23 +0000 (15:07 -0400)
releases.moxie
src/main/java/com/gitblit/git/PatchsetReceivePack.java

index f683f2bddb1a597d591f29ea2525ede5bbf2871e..151f9c300f5d1d49ea90faacc8596b94c5378034 100644 (file)
@@ -21,8 +21,10 @@ r22: {
     - Repository mailing lists could not be reset from the Edit Repository page (issue-399)
     - Fix intermittent NPE in determining commit date in RefModel (issue-401)
     - Fix closing ticket on push by parsing commit messages for closes|fixes (issue-404)
+    - Fix diffstat display for a ticket with a pending submodule change (issue-407)
     - Ensure the Lucene ticket index is updated on repository deletion.
     - Fixed failure to properly determine hasTicket in RedisTicketService
+    - Fixed handling of pushing ticket branch deletions
     changes:
     - Switch from GoogleCharts to self-hosted flotr2 charts (issue-283, ticket-43, pr-166)
     - Specify the --dailyLogFile option for the Ubuntu and CentOS service scripts (issue-348)
index 77d5a71ed8cce0c6dbe9e0b63fbffc84db840285..43efc54a3e4a1bcea873d920fed978ff45f4dcaa 100644 (file)
@@ -309,6 +309,7 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                        }\r
 \r
                        if (isPatchsetRef(cmd.getRefName()) && processPatchsets) {\r
+\r
                                if (ticketService == null) {\r
                                        sendRejection(cmd, "Sorry, the ticket service is unavailable and can not accept patchsets at this time.");\r
                                        continue;\r
@@ -346,6 +347,20 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                                        continue;\r
                                }\r
 \r
+                               if (cmd.getNewId().equals(ObjectId.zeroId())) {\r
+                                       // ref deletion request\r
+                                       if (cmd.getRefName().startsWith(Constants.R_TICKET)) {\r
+                                               if (user.canDeleteRef(repository)) {\r
+                                                       batch.addCommand(cmd);\r
+                                               } else {\r
+                                                       sendRejection(cmd, "Sorry, you do not have permission to delete {}", cmd.getRefName());\r
+                                               }\r
+                                       } else {\r
+                                               sendRejection(cmd, "Sorry, you can not delete {}", cmd.getRefName());\r
+                                       }\r
+                                       continue;\r
+                               }\r
+\r
                                if (patchsetRefCmd != null) {\r
                                        sendRejection(cmd, "You may only push one patchset at a time.");\r
                                        continue;\r