diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-11-09 18:36:42 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-12-05 11:38:19 +0400 |
commit | b7d44cfcf30151df728163cf13a30094b830e857 (patch) | |
tree | 991ed82090e198b1f35eb5d2a3c90469f2e85779 /LibGit2Sharp/Configuration.cs | |
parent | bbf0b7fa60d9b44bd29361f728d1c00547bcb718 (diff) |
Add XDG configuration store
Diffstat (limited to 'LibGit2Sharp/Configuration.cs')
-rw-r--r-- | LibGit2Sharp/Configuration.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs index d952506a..f314218f 100644 --- a/LibGit2Sharp/Configuration.cs +++ b/LibGit2Sharp/Configuration.cs @@ -17,6 +17,7 @@ namespace LibGit2Sharp IEnumerable<ConfigurationEntry<string>> { private readonly FilePath globalConfigPath; + private readonly FilePath xdgConfigPath; private readonly FilePath systemConfigPath; private readonly Repository repository; @@ -29,11 +30,13 @@ namespace LibGit2Sharp protected Configuration() { } - internal Configuration(Repository repository, string globalConfigurationFileLocation, string systemConfigurationFileLocation) + internal Configuration(Repository repository, string globalConfigurationFileLocation, + string xdgConfigurationFileLocation, string systemConfigurationFileLocation) { this.repository = repository; globalConfigPath = globalConfigurationFileLocation ?? Proxy.git_config_find_global(); + xdgConfigPath = xdgConfigurationFileLocation ?? Proxy.git_config_find_xdg(); systemConfigPath = systemConfigurationFileLocation ?? Proxy.git_config_find_system(); Init(); @@ -60,6 +63,11 @@ namespace LibGit2Sharp Proxy.git_config_add_file_ondisk(configHandle, globalConfigPath, ConfigurationLevel.Global); } + if (xdgConfigPath != null) + { + Proxy.git_config_add_file_ondisk(configHandle, xdgConfigPath, ConfigurationLevel.XDG); + } + if (systemConfigPath != null) { Proxy.git_config_add_file_ondisk(configHandle, systemConfigPath, ConfigurationLevel.System); @@ -70,9 +78,10 @@ namespace LibGit2Sharp /// Access configuration values without a repository. Generally you want to access configuration via an instance of <see cref = "Repository" /> instead. /// </summary> /// <param name="globalConfigurationFileLocation">Path to a Global configuration file. If null, the default path for a global configuration file will be probed.</param> + /// <param name="xdgConfigurationFileLocation">Path to a XDG configuration file. If null, the default path for a XDG configuration file will be probed.</param> /// <param name="systemConfigurationFileLocation">Path to a System configuration file. If null, the default path for a system configuration file will be probed.</param> - public Configuration(string globalConfigurationFileLocation = null, string systemConfigurationFileLocation = null) - : this(null, globalConfigurationFileLocation, systemConfigurationFileLocation) + public Configuration(string globalConfigurationFileLocation = null, string xdgConfigurationFileLocation = null, string systemConfigurationFileLocation = null) + : this(null, globalConfigurationFileLocation, xdgConfigurationFileLocation, systemConfigurationFileLocation) { } |