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());
}
}
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);
}
}
}
}
Aggregations