Skip to content

Commit

Permalink
[JENKINS-41255] Actually we should remove both sides of a match
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Jan 20, 2017
1 parent 95bd3e9 commit 6e2dece
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/jenkins/branch/MultiBranchProject.java
Expand Up @@ -392,19 +392,22 @@ public void setSourcesList(List<BranchSource> sources) throws IOException {
sources = new ArrayList<>(sources);
for (ListIterator<BranchSource> i = sources.listIterator(); i.hasNext(); ) {
BranchSource addition = i.next();
if (!additions.contains(addition.getSource().getId())) {
String additionId = addition.getSource().getId();
if (!additions.contains(additionId)) {
continue;
}
for (BranchSource removal: this.sources) {
if (!removals.contains(removal.getSource().getId())) {
String removalId = removal.getSource().getId();
if (!removals.contains(removalId)) {
continue;
}
if (!equalButForId(removal.getSource(), addition.getSource())) {
continue;
}
changedIds.put(removal.getSource().getId(), addition.getSource().getId());
// now take this one out of consideration
removals.remove(removal.getSource().getId());
changedIds.put(removalId, additionId);
// now take these two out of consideration
removals.remove(removalId);
additions.remove(additionId);
break;
}
}
Expand Down

0 comments on commit 6e2dece

Please sign in to comment.