| @@ -14,7 +14,6 @@ pub(crate) struct StageOne { · 13 unmodified lines |
| 14 | 14 | |
| 15 | 15 | is_bare: bool, |
| 16 | 16 | pub object_hash: git_hash::Kind, |
| 17 | | − use_multi_pack_index: bool, |
| 18 | 17 | pub reflog: Option<git_ref::store::WriteReflog>, |
| 19 | 18 | } |
| 20 | 19 | |
| @@ -38,7 +37,6 @@ impl StageOne { · 17 unmodified lines |
| 38 | 37 | }; |
| 39 | 38 | |
| 40 | 39 | let is_bare = config_bool(&config, "core.bare", false)?; |
| 41 | | − let use_multi_pack_index = config_bool(&config, "core.multiPackIndex", true)?; |
| 42 | 40 | let repo_format_version = config |
| 43 | 41 | .value::<Integer>("core", None, "repositoryFormatVersion") |
| 44 | 42 | .map_or(0, |v| v.to_decimal().unwrap_or_default()); |
| @@ -57,23 +55,13 @@ impl StageOne { · 12 unmodified lines |
| 57 | 55 | }) |
| 58 | 56 | .transpose()? |
| 59 | 57 | .unwrap_or(git_hash::Kind::Sha1); |
| 60 | | − let reflog = config.string("core", None, "logallrefupdates").map(|val| { |
| 61 | | − (val.eq_ignore_ascii_case(b"always")) |
| 62 | | − .then(|| git_ref::store::WriteReflog::Always) |
| 63 | | − .or_else(|| { |
| 64 | | − git_config::Boolean::try_from(val) |
| 65 | | − .ok() |
| 66 | | − .and_then(|b| b.is_true().then(|| git_ref::store::WriteReflog::Normal)) |
| 67 | | − }) |
| 68 | | − .unwrap_or(git_ref::store::WriteReflog::Disable) |
| 69 | | − }); |
| 70 | 58 | |
| 59 | + let reflog = query_refupdates(&config); |
| 71 | 60 | Ok(StageOne { |
| 72 | 61 | git_dir_config: config, |
| 73 | 62 | buf, |
| 74 | 63 | is_bare, |
| 75 | 64 | object_hash, |
| 76 | | − use_multi_pack_index, |
| 77 | 65 | reflog, |
| 78 | 66 | }) |
| 79 | 67 | } |
| @@ -86,8 +74,7 @@ impl Cache { · 6 unmodified lines |
| 86 | 74 | buf: _, |
| 87 | 75 | is_bare, |
| 88 | 76 | object_hash, |
| 89 | | − use_multi_pack_index, |
| 90 | | − reflog, |
| 77 | + reflog: _, |
| 91 | 78 | }: StageOne, |
| 92 | 79 | git_dir: &std::path::Path, |
| 93 | 80 | branch_name: Option<&git_ref::FullNameRef>, |
| @@ -117,7 +104,6 @@ impl Cache { · 23 unmodified lines |
| 117 | 104 | .path_filter("core", None, "excludesFile", &mut filter_config_section) |
| 118 | 105 | .map(|p| p.interpolate(options.includes.interpolate).map(|p| p.into_owned())) |
| 119 | 106 | .transpose()?; |
| 120 | | − let ignore_case = config_bool(&config, "core.ignoreCase", false)?; |
| 121 | 107 | |
| 122 | 108 | let mut hex_len = None; |
| 123 | 109 | if let Some(hex_len_str) = config.string("core", None, "abbrev") { |
| @@ -150,6 +136,9 @@ impl Cache { · 26 unmodified lines |
| 150 | 136 | } |
| 151 | 137 | } |
| 152 | 138 | |
| 139 | + let reflog = query_refupdates(&config); |
| 140 | + let ignore_case = config_bool(&config, "core.ignoreCase", false)?; |
| 141 | + let use_multi_pack_index = config_bool(&config, "core.multiPackIndex", true)?; |
| 153 | 142 | Ok(Cache { |
| 154 | 143 | resolved: config.into(), |
| 155 | 144 | use_multi_pack_index, |
| @@ -212,3 +201,16 @@ fn config_bool(config: &git_config::File<'_>, key: &str, default: bool) -> Resul · 56 unmodified lines |
| 212 | 201 | key: key.into(), |
| 213 | 202 | }) |
| 214 | 203 | } |
| 204 | + |
| 205 | +fn query_refupdates(config: &git_config::File<'static>) -> Option<git_ref::store::WriteReflog> { |
| 206 | + config.string("core", None, "logallrefupdates").map(|val| { |
| 207 | + (val.eq_ignore_ascii_case(b"always")) |
| 208 | + .then(|| git_ref::store::WriteReflog::Always) |
| 209 | + .or_else(|| { |
| 210 | + git_config::Boolean::try_from(val) |
| 211 | + .ok() |
| 212 | + .and_then(|b| b.is_true().then(|| git_ref::store::WriteReflog::Normal)) |
| 213 | + }) |
| 214 | + .unwrap_or(git_ref::store::WriteReflog::Disable) |
| 215 | + }) |
| 216 | +} |