mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-152043 git: add registry key to apply textconv when loading file content
This commit is contained in:
@@ -1160,6 +1160,8 @@ git.force.commit.using.staging.area=false
|
||||
git.force.commit.using.staging.area.description=When enabled, perform all git commits by updating staging area. If disable, use `git commit --only` when possible.
|
||||
git.clone.recurse.submodules=true
|
||||
git.clone.recurse.submodules.description=When enabled, Checkout from Git calls `git clone --recurse-submodules`, i.e. clones the main repository with all submodules if there are any.
|
||||
git.use.textconv=false
|
||||
git.use.textconv.description=Apply `textconv` transformations when reading file content from git.
|
||||
|
||||
hg4idea.process.ignored=true
|
||||
hg4idea.process.ignored.description=Process and highlight mercurial ignored files. \
|
||||
|
||||
@@ -238,6 +238,13 @@ public enum GitVersionSpecialty {
|
||||
public boolean existsIn(@NotNull GitVersion version) {
|
||||
return version.isLaterOrEqual(new GitVersion(2, 11, 0, 0));
|
||||
}
|
||||
},
|
||||
|
||||
CAT_FILE_SUPPORTS_TEXTCONV {
|
||||
@Override
|
||||
public boolean existsIn(@NotNull GitVersion version) {
|
||||
return version.isLaterOrEqual(new GitVersion(2, 2, 0, 0));
|
||||
}
|
||||
};
|
||||
|
||||
public abstract boolean existsIn(@NotNull GitVersion version);
|
||||
|
||||
@@ -17,6 +17,7 @@ package git4idea.util;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
@@ -33,6 +34,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.*;
|
||||
|
||||
import static git4idea.config.GitVersionSpecialty.CAT_FILE_SUPPORTS_FILTERS;
|
||||
import static git4idea.config.GitVersionSpecialty.CAT_FILE_SUPPORTS_TEXTCONV;
|
||||
|
||||
public class GitFileUtils {
|
||||
|
||||
@@ -171,7 +173,11 @@ public class GitFileUtils {
|
||||
public static byte[] getFileContent(Project project, VirtualFile root, String revisionOrBranch, String relativePath) throws VcsException {
|
||||
GitBinaryHandler h = new GitBinaryHandler(project, root, GitCommand.CAT_FILE);
|
||||
h.setSilent(true);
|
||||
if (CAT_FILE_SUPPORTS_FILTERS.existsIn(project)) {
|
||||
if (CAT_FILE_SUPPORTS_TEXTCONV.existsIn(project) &&
|
||||
Registry.is("git.use.textconv")) {
|
||||
h.addParameters("--textconv");
|
||||
}
|
||||
else if (CAT_FILE_SUPPORTS_FILTERS.existsIn(project)) {
|
||||
h.addParameters("--filters");
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user