Skip to content

Commit 1c2e755

Browse files
committed
adapt to changes in git-config
1 parent 84d594c commit 1c2e755

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

Diff for: cargo-smart-release/src/command/release/git.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ pub fn push_tags_and_head(
100100
.into_remote(git::remote::Direction::Push)
101101
.ok_or_else(|| anyhow!("Cannot push in uninitialized repo"))??
102102
.name()
103-
.expect("configured remotes have a name"),
103+
.expect("configured remotes have a name")
104+
.as_bstr()
105+
.to_string(),
104106
)
105107
.arg("HEAD");
106108
for tag_name in tag_names {

Diff for: gitoxide-core/src/organize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn find_origin_remote(repo: &Path) -> anyhow::Result<Option<git_url::Url>> {
104104
let config = git::config::File::from_path_no_includes(non_bare.as_path(), local)
105105
.or_else(|_| git::config::File::from_path_no_includes(repo.join("config").as_path(), local))?;
106106
Ok(config
107-
.string("remote", Some("origin"), "url")
107+
.string_by_key("remote.origin.url")
108108
.map(|url| git_url::Url::from_bytes(url.as_ref()))
109109
.transpose()?)
110110
}

Diff for: gitoxide-core/src/repository/config.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use anyhow::{bail, Result};
2+
use git::bstr::{BStr, BString};
23
use git_repository as git;
3-
use git_repository::bstr::BString;
44

55
use crate::OutputFormat;
66

77
pub fn list(
88
repo: git::Repository,
9-
filters: Vec<String>,
9+
filters: Vec<BString>,
1010
overrides: Vec<BString>,
1111
format: OutputFormat,
1212
mut out: impl std::io::Write,
@@ -52,18 +52,18 @@ pub fn list(
5252

5353
struct Filter {
5454
name: String,
55-
subsection: Option<String>,
55+
subsection: Option<BString>,
5656
}
5757

5858
impl Filter {
59-
fn new(input: String) -> Self {
60-
match git::config::parse::key(&input) {
59+
fn new(input: BString) -> Self {
60+
match git::config::parse::key(<_ as AsRef<BStr>>::as_ref(&input)) {
6161
Some(key) => Filter {
6262
name: key.section_name.into(),
6363
subsection: key.subsection_name.map(ToOwned::to_owned),
6464
},
6565
None => Filter {
66-
name: input,
66+
name: input.to_string(),
6767
subsection: None,
6868
},
6969
}
@@ -77,7 +77,7 @@ impl Filter {
7777
}
7878
match (self.subsection.as_deref(), section.header().subsection_name()) {
7979
(Some(filter), Some(name)) => {
80-
if !git::glob::wildmatch(filter.as_bytes().into(), name, ignore_case) {
80+
if !git::glob::wildmatch(filter.as_slice().into(), name, ignore_case) {
8181
return false;
8282
}
8383
}

Diff for: src/plumbing/options/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ pub enum Subcommands {
106106
}
107107

108108
pub mod config {
109+
use git::bstr::BString;
110+
use git_repository as git;
111+
109112
/// Print all entries in a configuration file or access other sub-commands
110113
#[derive(Debug, clap::Parser)]
111114
#[clap(subcommand_required(false))]
@@ -114,7 +117,8 @@ pub mod config {
114117
///
115118
/// Typical filters are `branch` or `remote.origin` or `remote.or*` - git-style globs are supported
116119
/// and comparisons are case-insensitive.
117-
pub filter: Vec<String>,
120+
#[clap(parse(try_from_os_str = git::env::os_str_to_bstring))]
121+
pub filter: Vec<BString>,
118122
}
119123
}
120124

0 commit comments

Comments
 (0)