pub enum ConfigLocation {
Local,
Global,
System,
Worktree,
File(PathBuf),
}Expand description
Which config file(s) to read or write.
Variants§
Local
Repository .git/config (or commondir/config for linked worktrees).
Global
Per-user global config (XDG + ~/.gitconfig, or GIT_CONFIG_GLOBAL).
System
System-wide /etc/gitconfig (or platform equivalent).
Worktree
Per-worktree config.worktree (when enabled).
File(PathBuf)
A single file from -f / --file.
Implementations§
Source§impl ConfigLocation
impl ConfigLocation
Sourcepub fn file_scope(&self) -> ConfigScope
pub fn file_scope(&self) -> ConfigScope
Scope stored in parsed entries from this location’s on-disk file.
Sourcepub fn write_path(
&self,
env: &Environment,
git_dir: Option<&Path>,
) -> Result<PathBuf>
pub fn write_path( &self, env: &Environment, git_dir: Option<&Path>, ) -> Result<PathBuf>
Path to create or update when writing a value at this location.
Global writes follow Git’s writer preference: an existing ~/.gitconfig, then an
existing XDG git/config, otherwise the conventional ~/.gitconfig.
§Errors
Returns Error::Config when the location needs a repository but none was given.
Sourcepub fn load_single(
&self,
env: &Environment,
git_dir: Option<&Path>,
) -> Result<ConfigSet>
pub fn load_single( &self, env: &Environment, git_dir: Option<&Path>, ) -> Result<ConfigSet>
Load configuration from this location only (no full cascade).
[include] / [includeIf] directives are expanded. Command-line overrides are not
included except for the full-repository ConfigSet::load path used by the CLI default
read mode.
Trait Implementations§
Source§impl Clone for ConfigLocation
impl Clone for ConfigLocation
Source§impl Debug for ConfigLocation
impl Debug for ConfigLocation
impl Eq for ConfigLocation
Source§impl PartialEq for ConfigLocation
impl PartialEq for ConfigLocation
impl StructuralPartialEq for ConfigLocation
Auto Trait Implementations§
impl Freeze for ConfigLocation
impl RefUnwindSafe for ConfigLocation
impl Send for ConfigLocation
impl Sync for ConfigLocation
impl Unpin for ConfigLocation
impl UnsafeUnpin for ConfigLocation
impl UnwindSafe for ConfigLocation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.