diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-14 15:07:23 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-14 15:07:23 -0400 |
commit | f254eee8b43efc924a8272f774de4e5a8333a7f5 (patch) | |
tree | 59284b5d2c0976f1a5db2a297f887845cc8f5693 | |
parent | a7af195bed674c2f0f1a74b69cefc8be1d90572d (diff) | |
download | gitblit-f254eee8b43efc924a8272f774de4e5a8333a7f5.tar.gz gitblit-f254eee8b43efc924a8272f774de4e5a8333a7f5.zip |
Improve ticket branch ref deletion push handling
-rw-r--r-- | releases.moxie | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/git/PatchsetReceivePack.java | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/releases.moxie b/releases.moxie index f683f2bd..151f9c30 100644 --- a/releases.moxie +++ b/releases.moxie @@ -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) diff --git a/src/main/java/com/gitblit/git/PatchsetReceivePack.java b/src/main/java/com/gitblit/git/PatchsetReceivePack.java index 77d5a71e..43efc54a 100644 --- a/src/main/java/com/gitblit/git/PatchsetReceivePack.java +++ b/src/main/java/com/gitblit/git/PatchsetReceivePack.java @@ -309,6 +309,7 @@ public class PatchsetReceivePack extends GitblitReceivePack { }
if (isPatchsetRef(cmd.getRefName()) && processPatchsets) {
+
if (ticketService == null) {
sendRejection(cmd, "Sorry, the ticket service is unavailable and can not accept patchsets at this time.");
continue;
@@ -346,6 +347,20 @@ public class PatchsetReceivePack extends GitblitReceivePack { continue;
}
+ if (cmd.getNewId().equals(ObjectId.zeroId())) {
+ // ref deletion request
+ if (cmd.getRefName().startsWith(Constants.R_TICKET)) {
+ if (user.canDeleteRef(repository)) {
+ batch.addCommand(cmd);
+ } else {
+ sendRejection(cmd, "Sorry, you do not have permission to delete {}", cmd.getRefName());
+ }
+ } else {
+ sendRejection(cmd, "Sorry, you can not delete {}", cmd.getRefName());
+ }
+ continue;
+ }
+
if (patchsetRefCmd != null) {
sendRejection(cmd, "You may only push one patchset at a time.");
continue;
|