summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-12 20:31:59 -0600
committerJames Moger <james.moger@gitblit.com>2014-03-12 20:31:59 -0600
commited882589e15422e03267ffb9ca6cb1a7376d1822 (patch)
treeb3b89e76916124a53590433f6867d24b9fd7049f /src/main
parent95224cfcb42b0d996e0c0abd7098fd97873ffb07 (diff)
parent1207947afee4d7fbd2ee374339d5e84bb0528e9a (diff)
downloadgitblit-ed882589e15422e03267ffb9ca6cb1a7376d1822.tar.gz
gitblit-ed882589e15422e03267ffb9ca6cb1a7376d1822.zip
Merged #30 "Watch list push parameters are not always honored"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/git/PatchsetReceivePack.java6
-rw-r--r--src/main/java/com/gitblit/models/TicketModel.java16
2 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/com/gitblit/git/PatchsetReceivePack.java b/src/main/java/com/gitblit/git/PatchsetReceivePack.java
index 697b8b9e..3ec3086a 100644
--- a/src/main/java/com/gitblit/git/PatchsetReceivePack.java
+++ b/src/main/java/com/gitblit/git/PatchsetReceivePack.java
@@ -163,11 +163,11 @@ public class PatchsetReceivePack extends GitblitReceivePack {
/** Extracts the ticket id from the ref name */
private long getTicketId(String refName) {
+ if (refName.indexOf('%') > -1) {
+ refName = refName.substring(0, refName.indexOf('%'));
+ }
if (refName.startsWith(Constants.R_FOR)) {
String ref = refName.substring(Constants.R_FOR.length());
- if (ref.indexOf('%') > -1) {
- ref = ref.substring(0, ref.indexOf('%'));
- }
try {
return Long.parseLong(ref);
} catch (Exception e) {
diff --git a/src/main/java/com/gitblit/models/TicketModel.java b/src/main/java/com/gitblit/models/TicketModel.java
index fa09ec59..aced6d78 100644
--- a/src/main/java/com/gitblit/models/TicketModel.java
+++ b/src/main/java/com/gitblit/models/TicketModel.java
@@ -785,7 +785,21 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
for (String item : items) {
list.add(prefix + item);
}
- setField(field, join(list, ","));
+ if (hasField(field)) {
+ String flat = getString(field);
+ if (isEmpty(flat)) {
+ // field is empty, use this list
+ setField(field, join(list, ","));
+ } else {
+ // merge this list into the existing field list
+ Set<String> set = new TreeSet<String>(Arrays.asList(flat.split(",")));
+ set.addAll(list);
+ setField(field, join(set, ","));
+ }
+ } else {
+ // does not have a list for this field
+ setField(field, join(list, ","));
+ }
}
public String getId() {