mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[vcs][git] override method, to allow get git repository structure without Project instance
GitOrigin-RevId: b4b9b75ea50d584390ce2e8c930be384fb2e4eaf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0839636890
commit
43c39b29af
@@ -95,10 +95,16 @@ public final class GitIndexUtil {
|
||||
public static @NotNull List<StagedFileOrDirectory> listTreeForRawPaths(@NotNull GitRepository repository,
|
||||
@NotNull List<String> filePaths,
|
||||
@NotNull VcsRevisionNumber revision) throws VcsException {
|
||||
List<StagedFileOrDirectory> result = new ArrayList<>();
|
||||
VirtualFile root = repository.getRoot();
|
||||
return listTreeForRawPaths(repository.getProject(), repository.getRoot(), filePaths, revision);
|
||||
}
|
||||
|
||||
GitLineHandler h = new GitLineHandler(repository.getProject(), root, GitCommand.LS_TREE);
|
||||
public static @NotNull List<StagedFileOrDirectory> listTreeForRawPaths(@Nullable Project project,
|
||||
@NotNull VirtualFile repositoryRoot,
|
||||
@NotNull List<String> filePaths,
|
||||
@NotNull VcsRevisionNumber revision) throws VcsException {
|
||||
List<StagedFileOrDirectory> result = new ArrayList<>();
|
||||
|
||||
GitLineHandler h = new GitLineHandler(project, repositoryRoot, GitCommand.LS_TREE);
|
||||
h.addParameters(revision.asString());
|
||||
h.endOptions();
|
||||
h.addParameters(filePaths);
|
||||
@@ -107,7 +113,7 @@ public final class GitIndexUtil {
|
||||
@Override
|
||||
public void onLineAvailable(String line, Key outputType) {
|
||||
if (outputType != ProcessOutputTypes.STDOUT) return;
|
||||
ContainerUtil.addIfNotNull(result, parseListTreeRecord(root, line));
|
||||
ContainerUtil.addIfNotNull(result, parseListTreeRecord(repositoryRoot, line));
|
||||
}
|
||||
});
|
||||
Git.getInstance().runCommandWithoutCollectingOutput(h).throwOnError();
|
||||
@@ -115,6 +121,7 @@ public final class GitIndexUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static @Nullable StagedFile parseListFilesStagedRecord(@NotNull VirtualFile root, @NotNull String line) {
|
||||
try {
|
||||
StringScanner s = new StringScanner(line);
|
||||
|
||||
Reference in New Issue
Block a user