@Test public void shouldUseTheManuallySpecifiedDirectory() throws Exception { File dotGitDir = Files.createTempDirectory("temp").toFile(); try { GitDirLocator locator = new GitDirLocator(project, reactorProjects); File foundDirectory = locator.lookupGitDirectory(dotGitDir); assert foundDirectory != null; assertThat(foundDirectory.getAbsolutePath()).isEqualTo(dotGitDir.getAbsolutePath()); } finally { if (!dotGitDir.delete()) { dotGitDir.deleteOnExit(); } } }
@Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) { if (manuallyConfiguredDir.exists()) { if (manuallyConfiguredDir.isDirectory()) { return manuallyConfiguredDir; } File gitDirLinkPath = processGitDirFile(manuallyConfiguredDir); if (isExistingDirectory(gitDirLinkPath)) { return gitDirLinkPath; } } return findProjectGitDirectory(); }
GitDirLocator { @Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) { if (manuallyConfiguredDir.exists()) { if (manuallyConfiguredDir.isDirectory()) { return manuallyConfiguredDir; } File gitDirLinkPath = processGitDirFile(manuallyConfiguredDir); if (isExistingDirectory(gitDirLinkPath)) { return gitDirLinkPath; } } return findProjectGitDirectory(); } }
GitDirLocator { @Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) { if (manuallyConfiguredDir.exists()) { if (manuallyConfiguredDir.isDirectory()) { return manuallyConfiguredDir; } File gitDirLinkPath = processGitDirFile(manuallyConfiguredDir); if (isExistingDirectory(gitDirLinkPath)) { return gitDirLinkPath; } } return findProjectGitDirectory(); } GitDirLocator(MavenProject mavenProject, List<MavenProject> reactorProjects); }
GitDirLocator { @Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) { if (manuallyConfiguredDir.exists()) { if (manuallyConfiguredDir.isDirectory()) { return manuallyConfiguredDir; } File gitDirLinkPath = processGitDirFile(manuallyConfiguredDir); if (isExistingDirectory(gitDirLinkPath)) { return gitDirLinkPath; } } return findProjectGitDirectory(); } GitDirLocator(MavenProject mavenProject, List<MavenProject> reactorProjects); @Nullable File lookupGitDirectory(@Nonnull File manuallyConfiguredDir); }
GitDirLocator { @Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) { if (manuallyConfiguredDir.exists()) { if (manuallyConfiguredDir.isDirectory()) { return manuallyConfiguredDir; } File gitDirLinkPath = processGitDirFile(manuallyConfiguredDir); if (isExistingDirectory(gitDirLinkPath)) { return gitDirLinkPath; } } return findProjectGitDirectory(); } GitDirLocator(MavenProject mavenProject, List<MavenProject> reactorProjects); @Nullable File lookupGitDirectory(@Nonnull File manuallyConfiguredDir);  }