Fix path handling

This commit is contained in:
René Pfeuffer
2020-05-11 14:21:25 +02:00
parent ae51a583fd
commit dbc58784e4
4 changed files with 27 additions and 5 deletions

View File

@@ -24,11 +24,13 @@
package sonia.scm.repository.spi;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@@ -140,4 +142,19 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
gitDiffCommand.getDiffResult(diffCommandRequest).accept(output);
assertEquals(DIFF_FILE_PARTIAL_MERGE, output.toString());
}
@Test
public void diffBetweenTwoBranchesWithMovedFiles() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("rename");
ByteArrayOutputStream output = new ByteArrayOutputStream();
gitDiffCommand.getDiffResult(diffCommandRequest).accept(output);
assertThat(output.toString())
.contains("similarity index 100%")
.contains("rename from a.txt")
.contains("rename to a-copy.txt")
.contains("rename from b.txt")
.contains("rename to b-copy.txt");
}
}