Skip to content

Commit 5663a2c

Browse files
committed
Merge branch 'config-key'
2 parents 9923542 + 78e48f2 commit 5663a2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1424
-919
lines changed

gitoxide-core/src/organize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn find_origin_remote(repo: &Path) -> anyhow::Result<Option<gix_url::Url>> {
9696
let config = gix::config::File::from_path_no_includes(non_bare.as_path().into(), local)
9797
.or_else(|_| gix::config::File::from_path_no_includes(repo.join("config"), local))?;
9898
Ok(config
99-
.string_by_key("remote.origin.url")
99+
.string("remote.origin.url")
100100
.map(|url| gix_url::Url::from_bytes(url.as_ref()))
101101
.transpose()?)
102102
}

gitoxide-core/src/repository/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::{bail, Result};
2-
use gix::bstr::{BStr, BString};
2+
use gix::{bstr::BString, config::AsKey};
33

44
use crate::OutputFormat;
55

@@ -57,7 +57,7 @@ struct Filter {
5757

5858
impl Filter {
5959
fn new(input: BString) -> Self {
60-
match gix::config::parse::key(<_ as AsRef<BStr>>::as_ref(&input)) {
60+
match input.try_as_key() {
6161
Some(key) => Filter {
6262
name: key.section_name.into(),
6363
subsection: key.subsection_name.map(ToOwned::to_owned),

gix-config/fuzz/fuzz_targets/fuzz_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn fuzz_immutable_section(section: &gix_config::file::Section<'_>, buf: &mut Vec
1717
let _ = black_box((key, value));
1818
}
1919
let mut seen = BTreeSet::new();
20-
for key in section.keys() {
20+
for key in section.value_names() {
2121
if seen.insert(key) {
2222
let _ = black_box(section.values(key.as_ref()));
2323
}
@@ -37,7 +37,7 @@ fn fuzz_mutable_section(
3737
// Mutate section.
3838
let section_id = {
3939
let mut section = file.section_mut(section_name, subsection_name)?;
40-
let key = section.keys().next().cloned();
40+
let key = section.value_names().next().cloned();
4141

4242
if let Some(key) = key {
4343
section.push_newline();

gix-config/src/file/access/comfort.rs

Lines changed: 108 additions & 120 deletions
Large diffs are not rendered by default.

gix-config/src/file/access/mutate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<'event> File<'event> {
172172
/// # use gix_config::parse::section;
173173
/// let mut git_config = gix_config::File::default();
174174
/// let mut section = git_config.new_section("hello", Some(Cow::Borrowed("world".into())))?;
175-
/// section.push(section::Key::try_from("a")?, Some("b".into()));
175+
/// section.push(section::ValueName::try_from("a")?, Some("b".into()));
176176
/// let nl = section.newline().to_owned();
177177
/// assert_eq!(git_config.to_string(), format!("[hello \"world\"]{nl}\ta = b{nl}"));
178178
/// let _section = git_config.new_section("core", None);

0 commit comments

Comments
 (0)