pub struct ConfigSnapshot { /* private fields */ }Expand description
What:
The parsed listing of one Git configuration read.
Why:
It is read once per commit with the caller’s global options, and reused by the consumers that would
otherwise each start git config.
In TS you’d write (pseudocode):
type ConfigSnapshot = { entries: ConfigEntry[]; readWithoutGlobalOptions: boolean };Implementations§
Source§impl ConfigSnapshot
impl ConfigSnapshot
Sourcepub fn parse(listing: &[u8], without_global_options: bool) -> Option<Self>
pub fn parse(listing: &[u8], without_global_options: bool) -> Option<Self>
What:
Parse the bytes of git config --list -z --show-scope.
Why:
The listing is scope NUL key [LF value] NUL repeated; a listing in any other shape is refused whole,
so a half-understood configuration is never used.
In TS you’d write (pseudocode):
parseConfigList(bytes, { withoutGlobalOptions });Sourcepub fn fsync_components(&self) -> Option<FsyncComponents>
pub fn fsync_components(&self) -> Option<FsyncComponents>
What:
The components core.fsync makes Git flush in this repository; None when the value is one this does not model.
Why:
Git’s own writes follow core.fsync and the service’s in-process writes follow the same setting. The last entry
decides alone and starts from the default (FsyncComponents::default_set); the reading is FsyncComponents::parse.
A key written without a value is refused by Git, so it is not modelled.
In TS you’d write (pseudocode):
const value = entries('core.fsync').at(-1); // undefined: the defaultSourcepub fn hardens_index(&self) -> Option<bool>
pub fn hardens_index(&self) -> Option<bool>
What:
Whether core.fsync names the index, so native Git flushes its index writes in this repository; None when the value is
one this does not model.
Why:
The service writes the index in process, so it follows the setting Git’s own index write follows. The components that
include the index are index, added and all.
In TS you’d write (pseudocode):
const hardens = fsyncComponents()?.has('index');Sourcepub fn import_fsync_value(&self) -> Option<String>
pub fn import_fsync_value(&self) -> Option<String>
What:
The core.fsync value to give the one git fast-import that imports a landing’s commits, or None when it is to be
left as it is.
Why:
Native Git writes the objects of a commit as loose objects, which its default core.fsync does not flush, while
fast-import flushes the temporary pack it writes (and deletes again when the batch is small). A repository that
names loose-object (or sets the deprecated core.fsyncObjectFiles) gets its set with the pack and its metadata
added when it lacks them, so a pack the import keeps is flushed as the loose objects would be; any other gets the set
it has without the packs; a value this does not model is left alone.
In TS you’d write (pseudocode):
set.has('loose-object') || legacyObjectFiles ? undefined : set.without('pack', 'pack-metadata').toValue()Sourcepub fn entries(&self) -> &[ConfigEntry]
pub fn entries(&self) -> &[ConfigEntry]
What: The entries in listing order. Why: Consumers that scan for a family of keys (hook definitions) read them directly.
In TS you’d write (pseudocode):
snapshot.entriesSourcepub fn without_global_options(&self) -> bool
pub fn without_global_options(&self) -> bool
What:
Whether the read carried no global options, so a consumer that runs Git without them may reuse it.
Why:
A -c, -C or --git-dir in front of the read changes what Git lists, and a consumer that ignores the
caller’s options must not see their effect.
In TS you’d write (pseudocode):
snapshot.withoutGlobalOptionsSourcepub fn path_value(&self, key: &str) -> Lookup<String>
pub fn path_value(&self, key: &str) -> Lookup<String>
What:
git config --type=path --get <key> for values Git returns unchanged.
Why:
core.hooksPath is read this way.
In TS you’d write (pseudocode):
snapshot.pathValue('core.hookspath');Sourcepub fn bool_value(&self, key: &str) -> Lookup<bool>
pub fn bool_value(&self, key: &str) -> Lookup<bool>
What:
git config --type=bool --get <key>.
Why:
The hook switches are read this way.
In TS you’d write (pseudocode):
snapshot.boolValue('hook.pre-commit.enabled');Sourcepub fn maintenance_records(&self) -> Option<BTreeMap<String, String>>
pub fn maintenance_records(&self) -> Option<BTreeMap<String, String>>
What:
The maintenance keys as git config --type=bool-or-int --null --get-regexp prints them: each set key
with the text of its last value.
Why:
The maintenance decision parses that listing; None when any maintenance entry is not modelled.
In TS you’d write (pseudocode):
snapshot.maintenanceRecords();Sourcepub fn proves_files_ref_storage(&self) -> bool
pub fn proves_files_ref_storage(&self) -> bool
What:
Whether the ref storage is proven to be the files backend.
Why:
git rev-parse --show-ref-format prints reftable only when extensions.refStorage is set, so a
listing without that key, read without global options, proves files; any listing that names the key
(in any scope, from any file) is left to Git, which also applies the repository-format rules.
In TS you’d write (pseudocode):
snapshot.withoutGlobalOptions && !snapshot.entries.some((entry) => entry.key === 'extensions.refstorage');Trait Implementations§
Source§impl Clone for ConfigSnapshot
impl Clone for ConfigSnapshot
Source§impl Debug for ConfigSnapshot
impl Debug for ConfigSnapshot
impl Eq for ConfigSnapshot
Source§impl PartialEq for ConfigSnapshot
impl PartialEq for ConfigSnapshot
impl StructuralPartialEq for ConfigSnapshot
Auto Trait Implementations§
impl Freeze for ConfigSnapshot
impl RefUnwindSafe for ConfigSnapshot
impl Send for ConfigSnapshot
impl Sync for ConfigSnapshot
impl Unpin for ConfigSnapshot
impl UnsafeUnpin for ConfigSnapshot
impl UnwindSafe for ConfigSnapshot
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more