How to access raw git conf from my plugin?

Answered

I want to access values from git config. does not matter global or local or system.

0
2 comments

So because at least one person is interested in the solution:
You need to use git4idea
so

Add git4idea to IntelliJ IDEA SDK from:
    .../idea-IC-201.7846.76/plugins/git4idea/lib/git4idea.jar

Add dependency to plugin.xml:
    <depends>Git4Idea</depends>

Code example (Scala)

    val git: Git = Git.getInstance()
val handler = new GitLineHandler(project, repoRoot, GitCommand.CONFIG)
handler.addParameters("user.name")
val commandResult = git.runCommand(handler)
commandResult.getOutput // use it

Of source parameters could be any, also more commands are available, not only config

cheers.

0

If you're using Gradle, you'll also need to add git4idea to your plugins list, like:

intellij {
plugins = [ 'git4idea' ]
}
0

Please sign in to leave a comment.