Skip to content

Commit 56588a9

Browse files
committed
Merge branch 'adjustments-for-cargo'
2 parents a96956b + 6738955 commit 56588a9

File tree

6 files changed

+75
-6
lines changed

6 files changed

+75
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ What follows is a high-level list of features and those which are planned:
4242
* [ ] push
4343
* [ ] reset
4444
* [ ] status
45+
* [x] blob-diff
4546
* [ ] merge
4647
* [ ] rebase
4748
* [ ] commit

gix-config/src/source.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ impl Source {
6565
pub fn storage_location(self, env_var: &mut dyn FnMut(&str) -> Option<OsString>) -> Option<Cow<'static, Path>> {
6666
use Source::*;
6767
match self {
68-
GitInstallation => gix_path::env::installation_config().map(Into::into),
68+
GitInstallation => {
69+
if env_var("GIT_CONFIG_NOSYSTEM").is_some() {
70+
None
71+
} else {
72+
gix_path::env::installation_config().map(Into::into)
73+
}
74+
}
6975
System => {
70-
if env_var("GIT_CONFIG_NO_SYSTEM").is_some() {
76+
if env_var("GIT_CONFIG_NOSYSTEM").is_some() {
7177
None
7278
} else {
7379
env_var("GIT_CONFIG_SYSTEM")

gix-config/tests/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ pub use gix_testtools::Result;
22

33
mod file;
44
mod parse;
5+
mod source;
56
mod value;

gix-config/tests/source/mod.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
use gix_config::Source;
2+
use std::path::Path;
3+
4+
#[test]
5+
fn git_config_no_system() {
6+
assert_eq!(
7+
Source::GitInstallation.storage_location(&mut |name| {
8+
assert_eq!(
9+
name, "GIT_CONFIG_NOSYSTEM",
10+
"it only checks this var, and if set, nothing else"
11+
);
12+
Some("1".into())
13+
}),
14+
None
15+
);
16+
assert_eq!(
17+
Source::System.storage_location(&mut |name| {
18+
assert_eq!(
19+
name, "GIT_CONFIG_NOSYSTEM",
20+
"it only checks this var, and if set, nothing else"
21+
);
22+
Some("1".into())
23+
}),
24+
None
25+
);
26+
}
27+
28+
#[test]
29+
fn git_config_system() {
30+
assert_eq!(
31+
Source::System
32+
.storage_location(&mut |name| {
33+
match name {
34+
"GIT_CONFIG_NOSYSTEM" => None,
35+
"GIT_CONFIG_SYSTEM" => Some("alternative".into()),
36+
unexpected => unreachable!("unexpected env var: {unexpected}"),
37+
}
38+
})
39+
.expect("set")
40+
.as_ref(),
41+
Path::new("alternative"),
42+
"we respect the system config variable for overrides"
43+
);
44+
}
45+
46+
#[test]
47+
fn git_config_global() {
48+
for source in [Source::Git, Source::User] {
49+
assert_eq!(
50+
source
51+
.storage_location(&mut |name| {
52+
assert_eq!(
53+
name, "GIT_CONFIG_GLOBAL",
54+
"it only checks this var, and if set, nothing else"
55+
);
56+
Some("alternative".into())
57+
})
58+
.expect("set")
59+
.as_ref(),
60+
Path::new("alternative"),
61+
"we respect the global config variable for 'git' overrides"
62+
);
63+
}
64+
}

gix/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- <csr-id-6cf73a44cbcd8bdca6a353cfd02d6237b1883b8c/> use `gitoxide.credentials.helperStderr` key to control how stderr is handled with helpers.
1616
That way users can configure each repository instance according to their needs,
1717
with which includes disabling the `stderr` of credential helpers.
18-
19-
Please enter the message for your patch. Lines starting with
2018
- <csr-id-77686db3f91e16fa6657dbae2182ec72e88d3fd0/> `revision::Spec::path_and_mode()`
2119
Provide additional information about revspecs for use with
2220
worktree filters.

gix/src/revision/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub use gix_revision as plumbing;
77

88
///
99
pub mod walk;
10-
use crate::bstr::BString;
1110
pub use walk::iter::Walk;
1211

1312
///
@@ -24,7 +23,7 @@ pub mod spec;
2423
pub struct Spec<'repo> {
2524
pub(crate) inner: gix_revision::Spec,
2625
/// The path we encountered in the revspec, like `@:<path>` or `@..@~1:<path>`.
27-
pub(crate) path: Option<(BString, gix_object::tree::EntryMode)>,
26+
pub(crate) path: Option<(crate::bstr::BString, gix_object::tree::EntryMode)>,
2827
/// The first name of a reference as seen while parsing a `RevSpec`, for completeness.
2928
pub(crate) first_ref: Option<gix_ref::Reference>,
3029
/// The second name of a reference as seen while parsing a `RevSpec`, for completeness.

0 commit comments

Comments
 (0)