diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1ad0d36bc..54d93caf09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Automatic user converter for external users ([#1380](https://github.com/scm-manager/scm-manager/pull/1380))
+### Fixed
+- Do not expose subversion commit with id 0 ([#1395](https://github.com/scm-manager/scm-manager/pull/1395))
+
## [2.8.0] - 2020-10-27
### Added
- Generation of email addresses for users, where none is configured ([#1370](https://github.com/scm-manager/scm-manager/pull/1370))
diff --git a/scm-packaging/windows/pom.xml b/scm-packaging/windows/pom.xml
index 4c2a25d2ff..9cd0dd1984 100644
--- a/scm-packaging/windows/pom.xml
+++ b/scm-packaging/windows/pom.xml
@@ -71,11 +71,11 @@
wget
- https://github.com/winsw/winsw/releases/download/v2.9.0/WinSW.NETCore31.x64.exe
+ https://github.com/winsw/winsw/releases/download/v2.10.3/WinSW.NETCore31.x86.exe
false
scm-server.exe
${project.build.directory}/windows
- 59d29a41652cfc9a564c9c05d77976391833a6fb686bce941ad89f8f8dff120b
+ d6ad842e104bfb200bca06d6724e3e1fb19d013fa62fa49a21298d2ee9b044b7
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java
index 26a851d1e2..7a8dd5e98d 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java
@@ -198,7 +198,7 @@ public final class SvnUtil
Person.toPerson(entry.getAuthor()),
entry.getMessage());
- if (revision > 0)
+ if (revision > 1)
{
changeset.getParents().add(String.valueOf(revision - 1));
}
@@ -232,6 +232,7 @@ public final class SvnUtil
*
* @return
*/
+ @SuppressWarnings("java:S1149") // we can not use StringBuild SVNXMLUtil requires StringBuffer
public static String createErrorBody(SVNErrorCode errorCode)
{
StringBuffer xmlBuffer = new StringBuffer();
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
index 35f5ec1fec..d613f9284d 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
@@ -26,6 +26,7 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
+import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
@@ -76,6 +77,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
try
{
long revisioNumber = parseRevision(revision, repository);
+ Preconditions.checkArgument(revisioNumber > 0, "revision must be greater than zero: %d", revisioNumber);
SVNRepository repo = open();
Collection entries = repo.log(null, null, revisioNumber,
revisioNumber, true, true);
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
index cab001573b..b758d7828c 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
@@ -32,10 +32,9 @@ import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Modifications;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import java.util.stream.StreamSupport;
+
+import static org.junit.Assert.*;
//~--- JDK imports ------------------------------------------------------------
@@ -56,11 +55,36 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
assertEquals(5, result.getChangesets().size());
}
+ @Test
+ public void shouldNotReturnChangesetWithIdZero() {
+ ChangesetPagingResult result = createCommand().getChangesets(new LogCommandRequest());
+ boolean found = StreamSupport.stream(result.spliterator(), false).anyMatch(c -> "0".equals(c.getId()));
+ assertFalse(found);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void shouldThrowIllegalArgumentExceptionForChangesetZero() {
+ createCommand().getChangeset("0", new LogCommandRequest());
+ }
+
+ @Test
+ public void shouldNotReturnChangesetZeroAsParent() {
+ Changeset changeset = createCommand().getChangeset("1", new LogCommandRequest());
+ assertTrue(changeset.getParents().isEmpty());
+ }
+
+ @Test
+ public void shouldAppendParentChangeset() {
+ Changeset changeset = createCommand().getChangeset("2", new LogCommandRequest());
+ assertEquals(1, changeset.getParents().size());
+ assertEquals("1", changeset.getParents().get(0));
+ }
+
@Test
public void testShouldStartWithRevisionOne() {
ChangesetPagingResult result = createCommand().getChangesets(new LogCommandRequest());
Changeset first = Iterables.getLast(result);
- assertEquals(first.getId(), "1");
+ assertEquals("1", first.getId());
}
@Test