-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: empty paths as configured will not be an error with lenient conf…
…iguration enabled. (#1370) When using `gix::open_opts(path, options.strict_config(false))`, empty `core.excludesFile` values will not cause an error anymore. Note that in strict mode, the behaviour is unchanged so invalid configuration can rather be fixed than ignored.
- Loading branch information
Showing
6 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+244 Bytes
(100%)
gix/tests/fixtures/generated-archives/make_basic_repo.tar.xz
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use crate::util::named_subrepo_opts; | ||
use gix_worktree::stack::state::ignore::Source; | ||
|
||
#[test] | ||
fn empty_core_excludes() -> crate::Result { | ||
let repo = named_subrepo_opts( | ||
"make_basic_repo.sh", | ||
"empty-core-excludes", | ||
gix::open::Options::default().strict_config(true), | ||
)?; | ||
let index = repo.index_or_empty()?; | ||
match repo.excludes(&**index, None, Source::WorktreeThenIdMappingIfNotSkipped) { | ||
Ok(_) => { | ||
unreachable!("Should fail due to empty excludes path") | ||
} | ||
Err(err) => { | ||
assert_eq!( | ||
err.to_string(), | ||
"The value for `core.excludesFile` could not be read from configuration" | ||
); | ||
} | ||
}; | ||
|
||
let repo = gix::open_opts(repo.git_dir(), repo.open_options().clone().strict_config(false))?; | ||
repo.excludes(&**index, None, Source::WorktreeThenIdMappingIfNotSkipped) | ||
.expect("empty paths are now just skipped"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters