mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
Add single trailers, not collection
Doing so will prevent empty collections being added to the trailers.
This commit is contained in:
@@ -47,20 +47,20 @@ public class ChangesetDescriptionTrailerProvider implements ChangesetPreProcesso
|
|||||||
|
|
||||||
private static class TrailerChangesetPreProcessor implements ChangesetPreProcessor {
|
private static class TrailerChangesetPreProcessor implements ChangesetPreProcessor {
|
||||||
|
|
||||||
private final List<Trailer> trailers = new ArrayList<>();
|
|
||||||
private final StringBuilder newDescription = new StringBuilder();
|
private final StringBuilder newDescription = new StringBuilder();
|
||||||
|
|
||||||
|
private Changeset changeset;
|
||||||
|
|
||||||
boolean foundEmptyLine;
|
boolean foundEmptyLine;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(Changeset changeset) {
|
public void process(Changeset changeset) {
|
||||||
|
this.changeset = changeset;
|
||||||
try (Scanner scanner = new Scanner(changeset.getDescription())) {
|
try (Scanner scanner = new Scanner(changeset.getDescription())) {
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
handleLine(scanner, scanner.nextLine());
|
handleLine(scanner, scanner.nextLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changeset.addTrailers(trailers);
|
|
||||||
changeset.setDescription(newDescription.toString());
|
changeset.setDescription(newDescription.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class ChangesetDescriptionTrailerProvider implements ChangesetPreProcesso
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createTrailer(String type, String name, String mail) {
|
private void createTrailer(String type, String name, String mail) {
|
||||||
trailers.add(new Trailer(type, new Person(name, mail)));
|
changeset.addTrailer(new Trailer(type, new Person(name, mail)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user