@@ -28,6 +28,8 @@ pub(crate) struct Cache {
28
28
pub object_hash : git_hash:: Kind ,
29
29
/// If true, multi-pack indices, whether present or not, may be used by the object database.
30
30
pub use_multi_pack_index : bool ,
31
+ /// The representation of `core.logallrefupdates`, or `None` if the variable wasn't set.
32
+ pub reflog : Option < git_ref:: store:: WriteReflog > ,
31
33
/// If true, we are on a case-insensitive file system.
32
34
#[ cfg_attr( not( feature = "git-index" ) , allow( dead_code) ) ]
33
35
pub ignore_case : bool ,
@@ -70,7 +72,7 @@ mod cache {
70
72
71
73
let is_bare = config_bool ( & config, "core.bare" , false ) ?;
72
74
let use_multi_pack_index = config_bool ( & config, "core.multiPackIndex" , true ) ?;
73
- let ignore_case = config_bool ( & config, "core.ignorecase " , false ) ?;
75
+ let ignore_case = config_bool ( & config, "core.ignoreCase " , false ) ?;
74
76
let excludes_file = config
75
77
. path ( "core" , None , "excludesFile" )
76
78
. map ( |p| {
@@ -84,12 +86,12 @@ mod cache {
84
86
. transpose ( ) ?;
85
87
let repo_format_version = config
86
88
. value :: < Integer > ( "core" , None , "repositoryFormatVersion" )
87
- . map_or ( 0 , |v| v. value ) ;
89
+ . map_or ( 0 , |v| v. to_decimal ( ) . unwrap_or_default ( ) ) ;
88
90
let object_hash = ( repo_format_version != 1 )
89
91
. then ( || Ok ( git_hash:: Kind :: Sha1 ) )
90
92
. or_else ( || {
91
93
config. string ( "extensions" , None , "objectFormat" ) . map ( |format| {
92
- if format. as_ref ( ) == "sha1" {
94
+ if format. as_ref ( ) . eq_ignore_ascii_case ( b "sha1") {
93
95
Ok ( git_hash:: Kind :: Sha1 )
94
96
} else {
95
97
Err ( Error :: UnsupportedObjectFormat {
@@ -100,13 +102,23 @@ mod cache {
100
102
} )
101
103
. transpose ( ) ?
102
104
. unwrap_or ( git_hash:: Kind :: Sha1 ) ;
105
+ let reflog = config. string ( "core" , None , "logallrefupdates" ) . map ( |val| {
106
+ ( val. eq_ignore_ascii_case ( b"always" ) )
107
+ . then ( || git_ref:: store:: WriteReflog :: Always )
108
+ . or_else ( || {
109
+ git_config:: Boolean :: try_from ( val)
110
+ . ok ( )
111
+ . and_then ( |b| b. is_true ( ) . then ( || git_ref:: store:: WriteReflog :: Normal ) )
112
+ } )
113
+ . unwrap_or ( git_ref:: store:: WriteReflog :: Disable )
114
+ } ) ;
103
115
104
116
let mut hex_len = None ;
105
117
if let Some ( hex_len_str) = config. string ( "core" , None , "abbrev" ) {
106
118
if hex_len_str. trim ( ) . is_empty ( ) {
107
119
return Err ( Error :: EmptyValue { key : "core.abbrev" } ) ;
108
120
}
109
- if hex_len_str. as_ref ( ) != "auto" {
121
+ if ! hex_len_str. eq_ignore_ascii_case ( b "auto") {
110
122
let value_bytes = hex_len_str. as_ref ( ) ;
111
123
if let Ok ( false ) = Boolean :: try_from ( value_bytes) . map ( Into :: into) {
112
124
hex_len = object_hash. len_in_hex ( ) . into ( ) ;
@@ -136,6 +148,7 @@ mod cache {
136
148
resolved : config. into ( ) ,
137
149
use_multi_pack_index,
138
150
object_hash,
151
+ reflog,
139
152
is_bare,
140
153
ignore_case,
141
154
hex_len,
0 commit comments