@CheckForNull
  @Override
  public Set<Path> branchChangedFiles(String targetBranchName, Path rootBaseDir) {
    return Optional.ofNullable((branchChangedFilesWithFileMovementDetection(targetBranchName, rootBaseDir)))
      .map(GitScmProvider::extractAbsoluteFilePaths)
      .orElse(null);
  }
@Test
  public void branchChangedFiles_use_remote_target_ref_when_running_on_circle_ci() throws IOException, GitAPIException {
    when(system2.envVariable("CIRCLECI")).thenReturn("true");
    git.checkout().setName("b1").setCreateBranch(true).call();
    createAndCommitFile("file-b1");

    Path worktree2 = temp.newFolder().toPath();
    Git local = Git.cloneRepository()
      .setURI(worktree.toString())
      .setDirectory(worktree2.toFile())
      .call();

    // Make local master match analyzed branch, so if local ref is used then change files will be empty
    local.checkout().setCreateBranch(true).setName("master").setStartPoint("origin/b1").call();
    local.checkout().setName("b1").call();

    assertThat(newScmProvider().branchChangedFiles("master", worktree2))
      .containsOnly(worktree2.resolve("file-b1"));
    verifyNoInteractions(analysisWarnings);
  }