Skip to content

Commit 38dee2a

Browse files
committed
re-clone the Git repository in setup
1 parent 6824825 commit 38dee2a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ public void setUpClass() throws Exception {
111111
repository = new TestRepository();
112112
repository.create(HistoryGuru.class.getResource("/repositories"));
113113

114+
// After copying the files from the archive, Git will consider the files to be changed,
115+
// at least on Windows. This causes some tests, particularly testGetIndexDownArgs() to fail.
116+
// To avoid this, clone the Git repository.
117+
Path gitRepositoryRootPath = Path.of(repository.getSourceRoot(), "git");
118+
Path gitCheckoutPath = Path.of(repository.getSourceRoot(), "gitcheckout");
119+
Git.cloneRepository()
120+
.setURI(gitRepositoryRootPath.toFile().toURI().toString())
121+
.setDirectory(gitCheckoutPath.toFile())
122+
.call();
123+
IOUtils.removeRecursive(gitRepositoryRootPath);
124+
Files.move(gitCheckoutPath, gitRepositoryRootPath);
125+
114126
env.setSourceRoot(repository.getSourceRoot());
115127
env.setDataRoot(repository.getDataRoot());
116128
env.setHistoryEnabled(true);

0 commit comments

Comments
 (0)