From 72f242e291b4baf94937e7a01b17bcbfa7b13008 Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Fri, 7 Jun 2024 15:48:07 +0200 Subject: [PATCH] [fragments] implement check if sparse checkout is active GitOrigin-RevId: e7b68514ea6473a08794fbad51638bee9c3ca543 --- plugins/git4idea/src/git4idea/config/GitConfigUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/config/GitConfigUtil.java b/plugins/git4idea/src/git4idea/config/GitConfigUtil.java index 10436f6cac2f..296c6476609f 100644 --- a/plugins/git4idea/src/git4idea/config/GitConfigUtil.java +++ b/plugins/git4idea/src/git4idea/config/GitConfigUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.config; import com.intellij.openapi.project.Project; @@ -75,6 +75,12 @@ public final class GitConfigUtil { return getValue(h, key); } + public static @Nullable String getValue(@NotNull Project project, @NotNull File root, @NotNull @NonNls String key) + throws VcsException { + GitLineHandler h = new GitLineHandler(project, root, GitCommand.CONFIG); + return getValue(h, key); + } + private static @Nullable String getValue(@NotNull GitLineHandler h, @NotNull @NonNls String key) throws VcsException { h.setEnableInteractiveCallbacks(false); h.setSilent(true);