-
-
Notifications
You must be signed in to change notification settings - Fork 361
Description
Current behavior 😯
gitoxide/gix/src/config/cache/util.rs
Lines 19 to 25 in d0ef276
pub(crate) fn base_options(lossy: Option<bool>, lenient: bool) -> gix_config::file::init::Options<'static> { | |
gix_config::file::init::Options { | |
lossy: lossy.unwrap_or(!cfg!(debug_assertions)), | |
ignore_io_errors: lenient, | |
..Default::default() | |
} | |
} |
We just ran into our tests failing in Jujutsu only on release builds, because our snapshots of the generated configuration suddenly lost all their whitespace. I was briefly wondering if some kind of bizarre compiler bug might be involved.
Expected behavior 🤔
Please reconsider this behaviour!
Release builds should not affect functionality, only performance and the presence of debug checks. Any behavioural change should be handled through feature flags. (From a quick search,
gitoxide/gix-transport/src/client/blocking_io/http/mod.rs
Lines 300 to 305 in d0ef276
#[cfg(not(debug_assertions))] | |
if self.url.starts_with("http://") { | |
return Err(client::Error::AuthenticationRefused( | |
"Will not send credentials in clear text over http", | |
)); | |
} |
But really, I think modifying repository configuration with gix
and writing it back out again should not silently throw away user data in general, even with a feature flag. If it affects lookup performance I think using a different data structure is the correct approach, not stripping out whitespace and comments.
Git behavior
Git doesn’t clobber configuration in this way.
Steps to reproduce 🕹
https://gist.github.com/demize/8a468be11b3b19069efca37323c352a2#file-minimum-reproducible-example-rs is not a minimal reproducer (just taking a snapshot and writing it back out suffices), but it works to demonstrate the problem.