@@ -24,30 +24,31 @@ use crate::file::{
24
24
mod collisions {
25
25
use crate :: file:: transaction:: prepare_and_commit:: { create_at, empty_store} ;
26
26
use git_lock:: acquire:: Fail ;
27
- use git_testtools:: once_cell:: sync:: Lazy ;
28
27
29
- static CASE_SENSITIVE : Lazy < bool > =
30
- Lazy :: new ( || !git_worktree:: fs:: Capabilities :: probe ( std:: env:: temp_dir ( ) ) . ignore_case ) ;
28
+ fn case_sensitive ( tmp_dir : & std:: path:: Path ) -> bool {
29
+ std:: fs:: write ( tmp_dir. join ( "config" ) , "" ) . expect ( "can create file once" ) ;
30
+ !git_worktree:: fs:: Capabilities :: probe ( tmp_dir) . ignore_case
31
+ }
31
32
32
33
#[ test]
33
- #[ ignore]
34
- fn conflicting_creation ( ) -> crate :: Result {
35
- let ( _dir, store) = empty_store ( ) ?;
34
+ fn conflicting_creation_without_packedrefs ( ) -> crate :: Result {
35
+ let ( dir, store) = empty_store ( ) ?;
36
36
let res = store. transaction ( ) . prepare (
37
37
[ create_at ( "refs/a" ) , create_at ( "refs/A" ) ] ,
38
38
Fail :: Immediately ,
39
39
Fail :: Immediately ,
40
40
) ;
41
41
42
+ let case_sensitive = case_sensitive ( dir. path ( ) ) ;
42
43
match res {
43
- Ok ( _) if * CASE_SENSITIVE => { }
44
- Ok ( _) if !* CASE_SENSITIVE => panic ! ( "should fail as 'a' and 'A' clash" ) ,
45
- Err ( err) if * CASE_SENSITIVE => panic ! (
44
+ Ok ( _) if case_sensitive => { }
45
+ Ok ( _) if !case_sensitive => panic ! ( "should fail as 'a' and 'A' clash" ) ,
46
+ Err ( err) if case_sensitive => panic ! (
46
47
"should work as case sensitivity allows 'a' and 'A' to coexist: {:?}" ,
47
48
err
48
49
) ,
49
- Err ( err) if !* CASE_SENSITIVE => {
50
- assert_eq ! ( err. to_string( ) , "foo " )
50
+ Err ( err) if !case_sensitive => {
51
+ assert_eq ! ( err. to_string( ) , "A lock could not be obtained for reference \" refs/A \" " )
51
52
}
52
53
_ => unreachable ! ( "actually everything is covered" ) ,
53
54
}
0 commit comments