| @@ -14,7 +14,6 @@ pub(crate) struct StageOne { · 13 unmodified lines |
| 14 | | 14 | |
| 15 | is_bare: bool, | 15 | is_bare: bool, |
| 16 | pub object_hash: git_hash::Kind, | 16 | pub object_hash: git_hash::Kind, |
| 17 | use_multi_pack_index: bool, | | |
| 18 | pub reflog: Option<git_ref::store::WriteReflog>, | 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 | let is_bare = config_bool(&config, "core.bare", false)?; | 39 | let is_bare = config_bool(&config, "core.bare", false)?; |
| 41 | let use_multi_pack_index = config_bool(&config, "core.multiPackIndex", true)?; | | |
| 42 | let repo_format_version = config | 40 | let repo_format_version = config |
| 43 | .value::<Integer>("core", None, "repositoryFormatVersion") | 41 | .value::<Integer>("core", None, "repositoryFormatVersion") |
| 44 | .map_or(0, |v| v.to_decimal().unwrap_or_default()); | 42 | .map_or(0, |v| v.to_decimal().unwrap_or_default()); |
| @@ -57,23 +55,13 @@ impl StageOne { · 12 unmodified lines |
| 57 | }) | 55 | }) |
| 58 | .transpose()? | 56 | .transpose()? |
| 59 | .unwrap_or(git_hash::Kind::Sha1); | 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 | Ok(StageOne { | 60 | Ok(StageOne { |
| 72 | git_dir_config: config, | 61 | git_dir_config: config, |
| 73 | buf, | 62 | buf, |
| 74 | is_bare, | 63 | is_bare, |
| 75 | object_hash, | 64 | object_hash, |
| 76 | use_multi_pack_index, | | |
| 77 | reflog, | 65 | reflog, |
| 78 | }) | 66 | }) |
| 79 | } | 67 | } |
| @@ -86,8 +74,7 @@ impl Cache { · 6 unmodified lines |
| 86 | buf: _, | 74 | buf: _, |
| 87 | is_bare, | 75 | is_bare, |
| 88 | object_hash, | 76 | object_hash, |
| 89 | use_multi_pack_index, | 77 | reflog: _, |
| 90 | reflog, | | |
| 91 | }: StageOne, | 78 | }: StageOne, |
| 92 | git_dir: &std::path::Path, | 79 | git_dir: &std::path::Path, |
| 93 | branch_name: Option<&git_ref::FullNameRef>, | 80 | branch_name: Option<&git_ref::FullNameRef>, |
| @@ -117,7 +104,6 @@ impl Cache { · 23 unmodified lines |
| 117 | .path_filter("core", None, "excludesFile", &mut filter_config_section) | 104 | .path_filter("core", None, "excludesFile", &mut filter_config_section) |
| 118 | .map(|p| p.interpolate(options.includes.interpolate).map(|p| p.into_owned())) | 105 | .map(|p| p.interpolate(options.includes.interpolate).map(|p| p.into_owned())) |
| 119 | .transpose()?; | 106 | .transpose()?; |
| 120 | let ignore_case = config_bool(&config, "core.ignoreCase", false)?; | | |
| 121 | | 107 | |
| 122 | let mut hex_len = None; | 108 | let mut hex_len = None; |
| 123 | if let Some(hex_len_str) = config.string("core", None, "abbrev") { | 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 | Ok(Cache { | 142 | Ok(Cache { |
| 154 | resolved: config.into(), | 143 | resolved: config.into(), |
| 155 | use_multi_pack_index, | 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 | key: key.into(), | 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 | } |