Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
25e795f
feat: Add `os_string_into_bstring()` as sibling of `os_str_into_bstr()`.
Byron Nov 24, 2022
0c98ec8
fix!: subsections are identified as `&BStr` in entire API.
Byron Nov 24, 2022
5fa9546
feat: comfort API like `string_by_key(key)` takes a key like `"remote…
Byron Nov 24, 2022
84d594c
feat!: more type-safety for remote names by making clear they can be …
Byron Nov 24, 2022
1c2e755
adapt to changes in `git-config`
Byron Nov 24, 2022
340dcad
Allow remote overrides for http options
Byron Nov 24, 2022
10f4f21
thanks clippy
Byron Nov 24, 2022
5c1abe7
pledge to support sparse checkouts from day one
Byron Nov 25, 2022
62cae0e
don't lock stdout/stderr as it will deadlock on dbg-printing
Byron Nov 25, 2022
4ebe2ac
doc: Actively discourage using `Boolean::try_from("")` explicitly.
Byron Nov 25, 2022
8e158c3
feat!: interpret the FollowRedirects option for the curl HTTP backend.
Byron Nov 25, 2022
b84ae6a
more faithfully parse http.followRedirect
Byron Nov 25, 2022
aeb4a1d
feat: add `--strict` option to enforce strict checking of configuration.
Byron Nov 25, 2022
872dc1a
update progress of http.proxyAuthMethod
Byron Nov 26, 2022
e4bf8f0
feat: Add the `Source::EnvOverride` to have a place for 'terminal' ov…
Byron Nov 26, 2022
5b9bffe
feat: `SectionMut::push_with_comment(key, comment)` to add a new vari…
Byron Nov 26, 2022
2b36d99
feat!: `File::new_section()` and related now returns their `id` as well.
Byron Nov 29, 2022
f16e361
feat!: remove `SnapshotMut::apply_cli_overrides()` in favor of `open:…
Byron Nov 28, 2022
0ce29a9
feat: `open::Options::modify()` as general pattern to allow builder m…
Byron Nov 28, 2022
f1a4c8b
adapt to changes in `git-repository`
Byron Nov 28, 2022
603f341
refactor
Byron Nov 28, 2022
e701e7e
feat: `client::http::Options::verbose` to see more debug output.
Byron Nov 29, 2022
5034544
feat: `client::http::Options::no_proxy` to disable a proxy for given …
Byron Nov 29, 2022
fc64693
feat: add `permissions::Environment::http_transport`.
Byron Nov 29, 2022
9441c26
apply related environment variables as config overrides
Byron Nov 26, 2022
49f39d6
change!: `open::ReplacementObjects` is removed in favor of two custom…
Byron Nov 29, 2022
a4ac9cf
change: represent `GIT_(COMMITTER|AUTHOR)_(NAME|EMAIL|DATE)` with git…
Byron Nov 29, 2022
becbd8d
feat!: represent object cache configuration like `GITOXIDE_PACK_CACHE…
Byron Nov 29, 2022
c4f68bf
adapt to changes in `git-repository`
Byron Nov 29, 2022
6b9632e
Merge branch 'main' into http-config
Byron Nov 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat!: File::new_section() and related now returns their id as well.
That way it's possible to more easily interact with it later, for instance
when one wants to delete it.
  • Loading branch information
Byron committed Nov 29, 2022
commit 2b36d99eaf3ed24ce4cb736a3dd48440dc0c73b7
1 change: 1 addition & 0 deletions git-config/src/file/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl<'a> File<'a> {
header: section.header,
body: section::Body(section.events),
meta: OwnShared::clone(&meta),
id: Default::default(),
});
}

Expand Down
7 changes: 7 additions & 0 deletions git-config/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub struct Section<'a> {
header: crate::parse::section::Header<'a>,
body: section::Body<'a>,
meta: OwnShared<Metadata>,
id: SectionId,
}

/// A function to filter metadata, returning `true` if the corresponding but omitted value can be used.
Expand Down Expand Up @@ -112,6 +113,12 @@ impl AddAssign<usize> for Size {
#[derive(PartialEq, Eq, Hash, Copy, Clone, PartialOrd, Ord, Debug)]
pub struct SectionId(pub(crate) usize);

impl Default for SectionId {
fn default() -> Self {
SectionId(usize::MAX)
}
}

/// All section body ids referred to by a section name.
///
/// Note that order in Vec matters as it represents the order
Expand Down
8 changes: 8 additions & 0 deletions git-config/src/file/section/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{
};

pub(crate) mod body;
use crate::file::SectionId;
pub use body::{Body, BodyIter};
use git_features::threading::OwnShared;

Expand All @@ -36,6 +37,7 @@ impl<'a> Section<'a> {
header: parse::section::Header::new(name, subsection)?,
body: Default::default(),
meta: meta.into(),
id: SectionId::default(),
})
}
}
Expand All @@ -47,6 +49,12 @@ impl<'a> Section<'a> {
&self.header
}

/// Return the unique `id` of the section, for use with the `*_by_id()` family of methods
/// in [git_config::File][crate::File].
pub fn id(&self) -> SectionId {
self.id
}

/// Return our body, containing all keys and values.
pub fn body(&self) -> &Body<'a> {
&self.body
Expand Down
6 changes: 4 additions & 2 deletions git-config/src/file/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use crate::{
/// Private helper functions
impl<'event> File<'event> {
/// Adds a new section to the config file, returning the section id of the newly added section.
pub(crate) fn push_section_internal(&mut self, section: file::Section<'event>) -> SectionId {
pub(crate) fn push_section_internal(&mut self, mut section: file::Section<'event>) -> SectionId {
let new_section_id = SectionId(self.section_id_counter);
section.id = new_section_id;
self.sections.insert(new_section_id, section);
let header = &self.sections[&new_section_id].header;
let lookup = self.section_lookup_tree.entry(header.name.clone()).or_default();
Expand Down Expand Up @@ -53,7 +54,7 @@ impl<'event> File<'event> {
}

/// Inserts `section` after the section that comes `before` it, and maintains correct ordering in all of our lookup structures.
pub(crate) fn insert_section_after(&mut self, section: file::Section<'event>, before: SectionId) -> SectionId {
pub(crate) fn insert_section_after(&mut self, mut section: file::Section<'event>, before: SectionId) -> SectionId {
let lookup_section_order = {
let section_order = &self.section_order;
move |section_id| {
Expand All @@ -67,6 +68,7 @@ impl<'event> File<'event> {

let before_order = lookup_section_order(before);
let new_section_id = SectionId(self.section_id_counter);
section.id = new_section_id;
self.sections.insert(new_section_id, section);
let header = &self.sections[&new_section_id].header;
let lookup = self.section_lookup_tree.entry(header.name.clone()).or_default();
Expand Down