@@ -4,7 +4,7 @@ use crate::{
44 parse_spec, parse_spec_better_than_baseline, parse_spec_no_baseline, parse_spec_no_baseline_opts,
55 parse_spec_opts, rev_parse,
66 } ,
7- util:: hex_to_id ,
7+ util:: hex_to_id_sha1_only ,
88} ;
99use gix:: {
1010 prelude:: { ObjectIdExt , RevSpecExt } ,
@@ -72,7 +72,7 @@ fn fully_failed_disambiguation_still_yields_an_ambiguity_error() {
7272#[ test]
7373fn ranges_are_auto_disambiguated_by_committish ( ) {
7474 let repo = repo ( "ambiguous_blob_tree_commit" ) . unwrap ( ) ;
75- let id = hex_to_id ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) ;
75+ let id = hex_to_id_sha1_only ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) ;
7676 let expected = gix_revision:: Spec :: Range { from : id, to : id } . attach ( & repo) ;
7777
7878 for spec in [ "000000000..000000000" , "..000000000" , "000000000.." ] {
@@ -103,25 +103,25 @@ fn blob_and_tree_can_be_disambiguated_by_type() {
103103
104104 assert_eq ! (
105105 parse_spec( "0000000000cdc^{tree}" , & repo) . unwrap( ) ,
106- Spec :: from_id( hex_to_id ( "0000000000cdcf04beb2fab69e65622616294984" ) . attach( & repo) ) ,
106+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000cdcf04beb2fab69e65622616294984" ) . attach( & repo) ) ,
107107 "this is unambiguous anyway, but also asserts for tree which is naturally the case"
108108 ) ;
109109
110110 assert_eq ! (
111111 parse_spec_better_than_baseline( "0000000000^{tree}" , & repo) . unwrap( ) ,
112- Spec :: from_id( hex_to_id ( "0000000000cdcf04beb2fab69e65622616294984" ) . attach( & repo) ) ,
112+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000cdcf04beb2fab69e65622616294984" ) . attach( & repo) ) ,
113113 "the commit refers to the tree which also starts with this prefix, so ultimately the result is unambiguous. Git can't do that yet."
114114 ) ;
115115
116116 assert_eq ! (
117117 parse_spec( "0000000000^{commit}" , & repo) . unwrap( ) ,
118- Spec :: from_id( hex_to_id ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
118+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
119119 "disambiguation with committish"
120120 ) ;
121121
122122 assert_eq ! (
123123 parse_spec( "0000000000e" , & repo) . unwrap( ) ,
124- Spec :: from_id( hex_to_id ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
124+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
125125 "no disambiguation needed here"
126126 ) ;
127127}
@@ -132,7 +132,7 @@ fn trees_can_be_disambiguated_by_blob_access() {
132132 let actual = parse_spec_better_than_baseline ( "0000000000:a0blgqsjc" , & repo) . unwrap ( ) ;
133133 assert_eq ! (
134134 actual,
135- Spec :: from_id( hex_to_id ( "0000000000b36b6aa7ea4b75318ed078f55505c3" ) . attach( & repo) ) ,
135+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000b36b6aa7ea4b75318ed078f55505c3" ) . attach( & repo) ) ,
136136 "we can disambiguate by providing a path, but git cannot"
137137 ) ;
138138 assert_eq ! (
@@ -147,7 +147,7 @@ fn commits_can_be_disambiguated_with_commit_specific_transformations() {
147147 for spec in [ "0000000000^0" , "0000000000^{commit}" ] {
148148 assert_eq ! (
149149 parse_spec( spec, & repo) . unwrap( ) ,
150- Spec :: from_id( hex_to_id ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) )
150+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) )
151151 ) ;
152152 }
153153}
@@ -157,7 +157,7 @@ fn tags_can_be_disambiguated_with_commit_specific_transformations() {
157157 let repo = repo ( "ambiguous_commits" ) . unwrap ( ) ;
158158 assert_eq ! (
159159 parse_spec_better_than_baseline( "0000000000^{tag}" , & repo) . unwrap( ) ,
160- Spec :: from_id( hex_to_id ( "0000000000f8f5507ab27a0d7bd3c75c0f64ffe0" ) . attach( & repo) ) ,
160+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000f8f5507ab27a0d7bd3c75c0f64ffe0" ) . attach( & repo) ) ,
161161 "disambiguation is possible by type, and git can't do that for some reason"
162162 ) ;
163163}
@@ -188,19 +188,19 @@ fn ambiguous_40hex_refs_are_ignored_and_we_prefer_the_object_of_the_same_name()
188188 let spec = "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ;
189189 assert_eq ! (
190190 parse_spec( spec, & repo) . unwrap( ) ,
191- Spec :: from_id( hex_to_id ( spec) . attach( & repo) ) ,
191+ Spec :: from_id( hex_to_id_sha1_only ( spec) . attach( & repo) ) ,
192192 "git shows an advisory here and ignores the ref, which makes it easy to just ignore it too. We are unable to show anything though, maybe traces?"
193193 ) ;
194194
195195 assert_eq ! (
196196 parse_spec_opts( spec, & repo, opts_ref_hint( RefsHint :: PreferObject ) ) . unwrap( ) ,
197- Spec :: from_id( hex_to_id ( spec) . attach( & repo) ) ,
197+ Spec :: from_id( hex_to_id_sha1_only ( spec) . attach( & repo) ) ,
198198 "preferring objects yields the same result here"
199199 ) ;
200200
201201 assert_eq ! (
202202 parse_spec_no_baseline_opts( spec, & repo, opts_ref_hint( RefsHint :: PreferRef ) ) . unwrap( ) ,
203- Spec :: from_id( hex_to_id ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
203+ Spec :: from_id( hex_to_id_sha1_only ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
204204 "we can prefer refs in any case, too"
205205 ) ;
206206
@@ -219,19 +219,19 @@ fn ambiguous_short_refs_are_dereferenced() {
219219 let spec = "0000000000e" ;
220220 assert_eq ! (
221221 parse_spec( spec, & repo) . unwrap( ) ,
222- Spec :: from_id( hex_to_id ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
222+ Spec :: from_id( hex_to_id_sha1_only ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
223223 "git shows a warning here and we show nothing but have dials to control how to handle these cases"
224224 ) ;
225225
226226 assert_eq ! (
227227 parse_spec_opts( spec, & repo, opts_ref_hint( RefsHint :: PreferRef ) ) . unwrap( ) ,
228- Spec :: from_id( hex_to_id ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
228+ Spec :: from_id( hex_to_id_sha1_only ( "cc60d25ccfee90e4a4105e73df36059db383d5ce" ) . attach( & repo) ) ,
229229 "this does the same, but independently of the length of the ref"
230230 ) ;
231231
232232 assert_eq ! (
233233 parse_spec_no_baseline_opts( spec, & repo, opts_ref_hint( RefsHint :: PreferObject ) ) . unwrap( ) ,
234- Spec :: from_id( hex_to_id ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
234+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000e4f9fbd19cf1e932319e5ad0d1d00b" ) . attach( & repo) ) ,
235235 "we can always prefer objects, too"
236236 ) ;
237237
@@ -250,7 +250,7 @@ fn repository_local_disambiguation_hints_disambiguate() {
250250 let r = repo ( "ambiguous_objects_disambiguation_config_committish" ) . unwrap ( ) ;
251251 assert_eq ! (
252252 rev_parse( "0000000000f" , & r) . unwrap( ) ,
253- Spec :: from_id( hex_to_id ( "0000000000f8f5507ab27a0d7bd3c75c0f64ffe0" ) . attach( & r) ) ,
253+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000f8f5507ab27a0d7bd3c75c0f64ffe0" ) . attach( & r) ) ,
254254 "we read the 'core.disambiguate' value and apply it to auto-disambiguate"
255255 ) ;
256256 let err = rev_parse ( "0000000000" , & r) . unwrap_err ( ) ;
@@ -281,7 +281,7 @@ fn repository_local_disambiguation_hints_disambiguate() {
281281 ) ;
282282
283283 {
284- let id = hex_to_id ( "00000000000434887f772f53e14e39497f7747d3" ) ;
284+ let id = hex_to_id_sha1_only ( "00000000000434887f772f53e14e39497f7747d3" ) ;
285285 let expected = gix_revision:: Spec :: Range { from : id, to : id } . attach ( & r) ;
286286 assert_eq ! (
287287 rev_parse( "00000000000..00000000000" , & r) . unwrap( ) ,
@@ -293,7 +293,7 @@ fn repository_local_disambiguation_hints_disambiguate() {
293293 let r = repo ( "ambiguous_objects_disambiguation_config_tree" ) . unwrap ( ) ;
294294 assert_eq ! (
295295 rev_parse( "0000000000f" , & r) . unwrap( ) ,
296- Spec :: from_id( hex_to_id ( "0000000000fd8bcc566027a4d16bde8434cac1a4" ) . attach( & r) ) ,
296+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000fd8bcc566027a4d16bde8434cac1a4" ) . attach( & r) ) ,
297297 "disambiguation may work precisely even with a simple object type constraint"
298298 ) ;
299299
@@ -310,7 +310,7 @@ fn repository_local_disambiguation_hints_disambiguate() {
310310 let r = repo ( "ambiguous_objects_disambiguation_config_blob" ) . unwrap ( ) ;
311311 assert_eq ! (
312312 rev_parse( "0000000000f" , & r) . unwrap( ) ,
313- Spec :: from_id( hex_to_id ( "0000000000f2fdf63f36c0d76aece18a79ab64f2" ) . attach( & r) ) ,
313+ Spec :: from_id( hex_to_id_sha1_only ( "0000000000f2fdf63f36c0d76aece18a79ab64f2" ) . attach( & r) ) ,
314314 ) ;
315315}
316316
0 commit comments