~/.gitconfig and $XDG_CONFIG_HOME/git/config.
For reading, both locations are considered, first the XDG file, then the file in the home directory. All updates occur in the last file read that exists, or in the home directory file if neither exists. In other words: if only the XDG file exists, it is updated, otherwise the home directory file is updated.
| Modifier and Type | Field and Description |
|---|---|
| private final FileBasedConfig |
| Access | Constructor and Description |
|---|---|
| public | UserConfigFile(Config
parent parent, File Config; may be nullFile for ~/.gitconfigFile for $XDG_CONFIG_HOME/.gitconfigFS to use for the two files; normally
FS#DETECTEDCreates a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isOutdated()
Overrides org. Whether the currently loaded configuration file is outdated |
| public void | load()
Overrides org. Load the configuration from the persistent store. |
| public boolean | removeSection(String
section name, e.g "branch" section, String optional subsection value, e.g. a branch name subsection)Overrides org. Removes all configuration values under a single section. |
| public void | save()
Overrides org. Save the configuration to the persistent store. |
| public void | setStringList(String
section name, e.g "branch" section, String optional subsection value, e.g. a branch name subsection, String parameter name, e.g. "filemode" name, List<String> list of zero or more values for this key. values)Overrides org. Set a configuration value. |
| public void | unset(String
section name, e.g "branch" section, String optional subsection value, e.g. a branch name subsection, String parameter name, e.g. "filemode" name)Overrides org. Remove a configuration value. |
| public void | unsetSection(String
section name, e.g "branch" section, String optional subsection value, e.g. a branch name subsection)Overrides org. Remove all configuration values under a single section. |
| parent | back to summary |
|---|---|
| private final FileBasedConfig parent | |
| UserConfigFile | back to summary |
|---|---|
| public UserConfigFile(Config parent, File config, File xdgConfig, FS fileSystem) Creates a new | |
| isOutdated | back to summary |
|---|---|
| public boolean isOutdated() Overrides org. Doc from org. Whether the currently loaded configuration file is outdated
| |
| load | back to summary |
|---|---|
| public void load() throws IOException, ConfigInvalidException Overrides org. Doc from org. Load the configuration from the persistent store. If the configuration does not exist, this configuration is cleared, and thus behaves the same as though the backing store exists, but is empty. Load the configuration as a Git text style configuration file. If the file does not exist, this configuration is cleared, and thus behaves the same as though the file exists, but is empty.
| |
| removeSection | back to summary |
|---|---|
| public boolean removeSection(String section, String subsection) Overrides org. Doc from org. Removes all configuration values under a single section. | |
| save | back to summary |
|---|---|
| public void save() throws IOException Overrides org. Doc from org. Save the configuration to the persistent store. Save the configuration as a Git text style configuration file. Warning Although this method uses the traditional Git file locking approach to protect against concurrent writes of the configuration file, it does not ensure that the file has not been modified since the last read, which means updates performed by other objects accessing the same backing file may be lost.
| |
| setStringList | back to summary |
|---|---|
| public void setStringList(String section, String subsection, String name, List<String> values) Overrides org. Doc from org. Set a configuration value.
[section "subsection"]
name = value1
name = value2
| |
| unset | back to summary |
|---|---|
| public void unset(String section, String subsection, String name) Overrides org. Doc from org. Remove a configuration value. | |
| unsetSection | back to summary |
|---|---|
| public void unsetSection(String section, String subsection) Overrides org. Doc from org. Remove all configuration values under a single section. | |