summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-04-24 09:52:21 -0400
committerDan Davison <dandavison7@gmail.com>2021-04-24 09:59:25 -0400
commit86a7a6a713b4b8e11510b2c27d26a3129865aa42 (patch)
tree8434707f1782543cf51bf8e75dd339ff832a7dc5
parentadb61d15cb9f69554b9ce1ddc05ee63e86daff84 (diff)
Add failing test: support new GIT_CONFIG_PARAMETERS format
-rw-r--r--src/git_config/mod.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/git_config/mod.rs b/src/git_config/mod.rs
index 5e309666..cbdab805 100644
--- a/src/git_config/mod.rs
+++ b/src/git_config/mod.rs
@@ -171,19 +171,25 @@ mod tests {
// [core]
// pager = env | grep GIT_CONFIG_PARAMETERS
- for env_var_value in &["'user.name=xxx'"] {
+ // We test multiple formats because the format of the value stored by
+ // git in this environment variable has changed in recent versions of
+ // Git. See
+ // https://github.com/git/git/blob/311531c9de557d25ac087c1637818bd2aad6eb3a/Documentation/RelNotes/2.31.0.txt#L127-L130
+
+ for env_var_value in &["'user.name=xxx'", "'user.name'='xxx'"] {
let config = parse_config_from_env_var_value(env_var_value);
assert!(config.is_empty());
}
- for env_var_value in &["'delta.plus-style=green'"] {
+ for env_var_value in &["'delta.plus-style=green'", "'delta.plus-style'='green'"] {
let config = parse_config_from_env_var_value(env_var_value);
assert_eq!(config["delta.plus-style"], "green");
}
- for env_var_value in
- &[r##"'user.name=xxx' 'delta.hunk-header-line-number-style=red "#067a00"'"##]
- {
+ for env_var_value in &[
+ r##"'user.name=xxx' 'delta.hunk-header-line-number-style=red "#067a00"'"##,
+ r##"'user.name'='xxx' 'delta.hunk-header-line-number-style'='red "#067a00"'"##,
+ ] {
let config = parse_config_from_env_var_value(env_var_value);
assert_eq!(
config["delta.hunk-header-line-number-style"],
@@ -191,13 +197,17 @@ mod tests {
);
}
- for env_var_value in &[r##"'user.name=xxx' 'delta.side-by-side=false'"##] {
+ for env_var_value in &[
+ r##"'user.name=xxx' 'delta.side-by-side=false'"##,
+ r##"'user.name'='xxx' 'delta.side-by-side'='false'"##,
+ ] {
let config = parse_config_from_env_var_value(env_var_value);
assert_eq!(config["delta.side-by-side"], "false");
}
for env_var_value in &[
r##"'delta.plus-style=green' 'delta.side-by-side=false' 'delta.hunk-header-line-number-style=red "#067a00"'"##,
+ r##"'delta.plus-style'='green' 'delta.side-by-side'='false' 'delta.hunk-header-line-number-style'='red "#067a00"'"##,
] {
let config = parse_config_from_env_var_value(env_var_value);
assert_eq!(config["delta.plus-style"], "green");