Search in sources :

Example 1 with GitUntrackedFilesHolder

use of git4idea.repo.GitUntrackedFilesHolder in project intellij-community by JetBrains.

the class GitNewChangesCollector method collectUnversionedFiles.

private void collectUnversionedFiles() throws VcsException {
    if (myRepository == null) {
        // if GitRepository was not initialized at the time of creation of the GitNewChangesCollector => collecting unversioned files by hands.
        myUnversionedFiles.addAll(myGit.untrackedFiles(myProject, myVcsRoot, null));
    } else {
        GitUntrackedFilesHolder untrackedFilesHolder = myRepository.getUntrackedFilesHolder();
        myUnversionedFiles.addAll(untrackedFilesHolder.retrieveUntrackedFiles());
    }
}
Also used : GitUntrackedFilesHolder(git4idea.repo.GitUntrackedFilesHolder)

Example 2 with GitUntrackedFilesHolder

use of git4idea.repo.GitUntrackedFilesHolder in project intellij-community by JetBrains.

the class GitRollbackEnvironment method unindex.

/**
   * Remove file paths from index (git remove --cached).
   *
   * @param root  a git root
   * @param files files to remove from index.
   * @param toUnversioned passed true if the file will be unversioned after unindexing, i.e. it was added before the revert operation.
   * @throws VcsException if there is a problem with running git
   */
private void unindex(final VirtualFile root, final List<FilePath> files, boolean toUnversioned) throws VcsException {
    GitFileUtils.delete(myProject, root, files, "--cached", "-f");
    if (toUnversioned) {
        final GitRepository repo = GitUtil.getRepositoryManager(myProject).getRepositoryForRoot(root);
        final GitUntrackedFilesHolder untrackedFilesHolder = (repo == null ? null : repo.getUntrackedFilesHolder());
        for (FilePath path : files) {
            final VirtualFile vf = VcsUtil.getVirtualFile(path.getIOFile());
            if (untrackedFilesHolder != null && vf != null) {
                untrackedFilesHolder.add(vf);
            }
        }
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitRepository(git4idea.repo.GitRepository) GitUntrackedFilesHolder(git4idea.repo.GitUntrackedFilesHolder)

Aggregations

GitUntrackedFilesHolder (git4idea.repo.GitUntrackedFilesHolder)2 FilePath (com.intellij.openapi.vcs.FilePath)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitRepository (git4idea.repo.GitRepository)1