Skip to content

Commit b218055

Browse files
committed
fix: avoid modifying state of context in eachUrlPart
1 parent 57a9407 commit b218055

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies {
1818

1919
testImplementation 'org.slf4j:slf4j-simple:2.0.16'
2020
testImplementation 'junit:junit:4.13.2'
21-
testImplementation 'org.assertj:assertj-core:3.27.2'
21+
testImplementation 'org.assertj:assertj-core:3.27.3'
2222
testImplementation 'com.approvaltests:approvaltests:24.14.2'
2323
testImplementation 'org.mockito:mockito-core:5.15.2'
2424
}

Diff for: src/main/java/se/bjurr/gitchangelog/api/helpers/Helpers.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.github.jknack.handlebars.Options.Buffer;
2929
import com.github.jknack.handlebars.helper.EachHelper;
3030
import java.io.IOException;
31+
import java.util.ArrayList;
3132
import java.util.Collections;
3233
import java.util.List;
3334
import java.util.Map;
@@ -243,8 +244,9 @@ public static Map<String, Helper<?>> getAll() {
243244
helpers.put(
244245
"eachUrlPart",
245246
(final Changelog changelog, final Options options) -> {
246-
Collections.reverse(changelog.getUrlParts());
247-
return each(options, changelog.getUrlParts());
247+
List<String> reversedList = new ArrayList<>(changelog.getUrlParts());
248+
Collections.reverse(reversedList);
249+
return each(options, reversedList);
248250
});
249251
return helpers;
250252
}

0 commit comments

Comments
 (0)