File tree Expand file tree Collapse file tree
gitoxide-core/src/repository Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,9 +59,8 @@ pub(crate) mod function {
5959 let mut remote = crate :: repository:: remote:: by_name_or_url ( & repo, remote. as_deref ( ) ) ?;
6060 let mut wants = Vec :: new ( ) ;
6161 let mut fetch_refspecs = Vec :: new ( ) ;
62- let expected_hex_len = repo. object_hash ( ) . len_in_hex ( ) ;
6362 for spec in ref_specs {
64- if spec. len ( ) == expected_hex_len {
63+ if spec. len ( ) == repo . object_hash ( ) . len_in_hex ( ) {
6564 if let Ok ( oid) = ObjectId :: from_hex ( spec. as_ref ( ) ) {
6665 wants. push ( oid) ;
6766 continue ;
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ pub enum Error {
2525 source : crate :: bstr:: Utf8Error ,
2626 remote_name : crate :: bstr:: BString ,
2727 } ,
28- #[ error( "Configuration value name {name:?} is invalid" ) ]
29- ConfigValueName {
30- name : & ' static str ,
31- source : gix_config:: parse:: section:: value_name:: Error ,
32- } ,
3328 #[ error( transparent) ]
3429 ConfigSectionHeader ( #[ from] gix_config:: parse:: section:: header:: Error ) ,
3530 #[ error( transparent) ]
@@ -218,7 +213,7 @@ impl PrepareFetch {
218213 let filter_spec_to_save = self
219214 . filter
220215 . as_ref ( )
221- . map ( crate :: remote:: fetch:: ObjectFilter :: to_argument_string) ;
216+ . map ( remote:: fetch:: ObjectFilter :: to_argument_string) ;
222217 let config =
223218 util:: write_remote_to_local_config_file ( & mut remote, remote_name. clone ( ) , filter_spec_to_save. as_deref ( ) ) ?;
224219
Original file line number Diff line number Diff line change @@ -38,25 +38,16 @@ pub fn write_remote_to_local_config_file(
3838 while remote_section. remove ( "partialclonefilter" ) . is_some ( ) { }
3939 while remote_section. remove ( "promisor" ) . is_some ( ) { }
4040
41- let partial_clone_filter = ValueName :: try_from ( "partialclonefilter" ) . map_err ( |err| Error :: ConfigValueName {
42- name : "partialclonefilter" ,
43- source : err,
44- } ) ?;
45- remote_section. push ( partial_clone_filter, Some ( BStr :: new ( filter_spec) ) ) ;
41+ let partial_clone_filter = ValueName :: try_from ( "partialclonefilter" ) . expect ( "known to be valid" ) ;
42+ remote_section. push ( partial_clone_filter, Some ( filter_spec. into ( ) ) ) ;
4643
47- let promisor = ValueName :: try_from ( "promisor" ) . map_err ( |err| Error :: ConfigValueName {
48- name : "promisor" ,
49- source : err,
50- } ) ?;
51- remote_section. push ( promisor, Some ( BStr :: new ( "true" ) ) ) ;
44+ let promisor = ValueName :: try_from ( "promisor" ) . expect ( "known to be valid" ) ;
45+ remote_section. push ( promisor, Some ( "true" . into ( ) ) ) ;
5246
5347 let mut extensions_section = config. section_mut_or_create_new ( "extensions" , None ) ?;
54- while extensions_section. remove ( "partialclone " ) . is_some ( ) { }
48+ while extensions_section. remove ( "partialClone " ) . is_some ( ) { }
5549
56- let partial_clone = ValueName :: try_from ( "partialclone" ) . map_err ( |err| Error :: ConfigValueName {
57- name : "partialclone" ,
58- source : err,
59- } ) ?;
50+ let partial_clone = ValueName :: try_from ( "partialClone" ) . expect ( "known to be valid" ) ;
6051 extensions_section. push ( partial_clone, Some ( remote_name. as_ref ( ) ) ) ;
6152 }
6253
You can’t perform that action at this time.
0 commit comments