1
1
mod existing {
2
- use gix_ref:: { PartialName , PartialNameRef } ;
3
-
4
2
use crate :: { file:: store_at, hex_to_id} ;
5
3
6
4
#[ test]
@@ -13,12 +11,41 @@ mod existing {
13
11
Ok ( ( ) )
14
12
}
15
13
16
- // TODO: figure this out
17
- #[ test]
18
- fn possible_inputs ( ) -> crate :: Result {
19
- let store = crate :: file:: store ( ) ?;
20
- store. find_loose ( "dt1" ) ?;
21
- store. find_loose ( & String :: from ( "dt1" ) ) ?; // Owned Strings don't have an impl for PartialName
14
+ mod convert {
15
+ use gix_ref:: { PartialName , PartialNameRef } ;
16
+
17
+ // TODO: figure this out
18
+ #[ test]
19
+ fn possible_inputs ( ) -> crate :: Result {
20
+ let store = crate :: file:: store ( ) ?;
21
+ store. find_loose ( "dt1" ) ?;
22
+ store. find_loose ( & String :: from ( "dt1" ) ) ?; // Owned Strings don't have an impl for PartialName
23
+
24
+ store. find_loose ( & CustomType ( "dt1" . into ( ) ) ) ?;
25
+
26
+ let name = CustomName {
27
+ remote : "origin" ,
28
+ branch : "main" ,
29
+ } ;
30
+ store. find_loose ( & name. to_partial_name ( ) ) ?;
31
+ // TODO: this effectively needs a `Cow<'_, PartialNameRef>`, but we are not allowed to implement conversions for it.
32
+ // After having been there, I don't want to have a `PartialNameCow(Cow<'_, PartialNameRef)` anymore, nor
33
+ // copies of `TryFrom/TryInto` traits in our crate.
34
+ // Make it work once we can implement standard traits for Cow<OurType>.
35
+ // store.find_loose(&name)?;
36
+ // store.find_loose(name.to_partial_name())?;
37
+ store. find_loose ( & name. to_partial_name_from_string ( ) ) ?;
38
+ store. find_loose ( & name. to_partial_name_from_bstring ( ) ) ?;
39
+ store. find_loose ( & name. to_full_name ( ) ) ?;
40
+ store. find_loose ( name. to_full_name ( ) . as_ref ( ) ) ?;
41
+ store. find_loose ( name. to_full_name ( ) . as_ref ( ) . as_partial_name ( ) ) ?;
42
+ store. find_loose ( & PartialName :: try_from ( name. remote ) ?. join ( name. branch . into ( ) ) ?) ?;
43
+ store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( "main" . into ( ) ) ?) ?;
44
+ store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( String :: from ( "main" ) . as_str ( ) . into ( ) ) ?) ?;
45
+ store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( "main" . into ( ) ) ?) ?;
46
+
47
+ Ok ( ( ) )
48
+ }
22
49
23
50
struct CustomType ( String ) ;
24
51
impl < ' a > TryFrom < & ' a CustomType > for & ' a PartialNameRef {
@@ -28,7 +55,6 @@ mod existing {
28
55
value. 0 . as_str ( ) . try_into ( )
29
56
}
30
57
}
31
- store. find_loose ( & CustomType ( "dt1" . into ( ) ) ) ?;
32
58
33
59
struct CustomName {
34
60
remote : & ' static str ,
@@ -61,29 +87,6 @@ mod existing {
61
87
PartialName :: try_from ( value. to_partial_name ( ) )
62
88
}
63
89
}
64
-
65
- let name = CustomName {
66
- remote : "origin" ,
67
- branch : "main" ,
68
- } ;
69
- store. find_loose ( & name. to_partial_name ( ) ) ?;
70
- // TODO: this effectively needs a `Cow<'_, PartialNameRef>`, but we are not allowed to implement conversions for it.
71
- // After having been there, I don't want to have a `PartialNameCow(Cow<'_, PartialNameRef)` anymore, nor
72
- // copies of `TryFrom/TryInto` traits in our crate.
73
- // Make it work once we can implement standard traits for Cow<OurType>.
74
- // store.find_loose(&name)?;
75
- // store.find_loose(name.to_partial_name())?;
76
- store. find_loose ( & name. to_partial_name_from_string ( ) ) ?;
77
- store. find_loose ( & name. to_partial_name_from_bstring ( ) ) ?;
78
- store. find_loose ( & name. to_full_name ( ) ) ?;
79
- store. find_loose ( name. to_full_name ( ) . as_ref ( ) ) ?;
80
- store. find_loose ( name. to_full_name ( ) . as_ref ( ) . as_partial_name ( ) ) ?;
81
- store. find_loose ( & PartialName :: try_from ( name. remote ) ?. join ( name. branch . into ( ) ) ?) ?;
82
- store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( "main" . into ( ) ) ?) ?;
83
- store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( String :: from ( "main" ) . as_str ( ) . into ( ) ) ?) ?;
84
- store. find_loose ( & PartialName :: try_from ( "origin" ) ?. join ( "main" . into ( ) ) ?) ?;
85
-
86
- Ok ( ( ) )
87
90
}
88
91
}
89
92
0 commit comments