]> source.dussan.org Git - gitblit.git/commitdiff
Fix incorrect REWIND labeling in reflog on all ticket pushes
authorJames Moger <james.moger@gitblit.com>
Tue, 8 Apr 2014 03:32:48 +0000 (23:32 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 8 Apr 2014 03:32:48 +0000 (23:32 -0400)
src/main/java/com/gitblit/git/PatchsetReceivePack.java

index 64a739e59fa20890b77cc459d4ec8d73361ec423..2c3b957bfe08563d69e17faf2e63b5b8f32adea3 100644 (file)
@@ -437,7 +437,10 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                                patchsetRefCmd.setResult(Result.OK);\r
 \r
                                // update the ticket branch ref\r
-                               RefUpdate ru = updateRef(patchsetCmd.getTicketBranch(), patchsetCmd.getNewId());\r
+                               RefUpdate ru = updateRef(\r
+                                               patchsetCmd.getTicketBranch(),\r
+                                               patchsetCmd.getNewId(),\r
+                                               patchsetCmd.getPatchsetType());\r
                                updateReflog(ru);\r
 \r
                                TicketModel ticket = processPatchset(patchsetCmd);\r
@@ -835,8 +838,8 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                                        psCmd.updateTicket(c, mergeTo, ticket, null);\r
 \r
                                        // create a ticket patchset ref\r
-                                       updateRef(psCmd.getPatchsetBranch(), c.getId());\r
-                                       RefUpdate ru = updateRef(psCmd.getTicketBranch(), c.getId());\r
+                                       updateRef(psCmd.getPatchsetBranch(), c.getId(), patchset.type);\r
+                                       RefUpdate ru = updateRef(psCmd.getTicketBranch(), c.getId(), patchset.type);\r
                                        updateReflog(ru);\r
 \r
                                        // create a change from the patchset command\r
@@ -1052,7 +1055,7 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                return newPatchset;\r
        }\r
 \r
-       private RefUpdate updateRef(String ref, ObjectId newId) {\r
+       private RefUpdate updateRef(String ref, ObjectId newId, PatchsetType type) {\r
                ObjectId ticketRefId = ObjectId.zeroId();\r
                try {\r
                        ticketRefId = getRepository().resolve(ref);\r
@@ -1063,7 +1066,17 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                try {\r
                        RefUpdate ru = getRepository().updateRef(ref,  false);\r
                        ru.setRefLogIdent(getRefLogIdent());\r
-                       ru.setForceUpdate(true);\r
+                       switch (type) {\r
+                       case Amend:\r
+                       case Rebase:\r
+                       case Rebase_Squash:\r
+                       case Squash:\r
+                               ru.setForceUpdate(true);\r
+                               break;\r
+                       default:\r
+                               break;\r
+                       }\r
+\r
                        ru.setExpectedOldObjectId(ticketRefId);\r
                        ru.setNewObjectId(newId);\r
                        RefUpdate.Result result = ru.update(getRevWalk());\r