File tree Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -28,4 +28,3 @@ git-testtools = "0.8.0"
2828# git-repository = "0.22.1"
2929git-repository = { version = " 0.22.1" , git = " https://github.com/Byron/gitoxide" , branch = " for-crates-index-diff" }
3030tempdir = " 0.3.5"
31- serial_test = " 0.6.0"
Original file line number Diff line number Diff line change 11use crates_index_diff:: Index ;
2+ use git_testtools:: tempfile:: TempDir ;
3+ use std:: path:: PathBuf ;
24
35mod changes_from_objects;
46
@@ -32,14 +34,31 @@ fn peek_changes() {
3234 ) ;
3335}
3436
35- mod old;
37+ #[ test]
38+ fn clone_if_needed ( ) {
39+ let tmp = TempDir :: new ( ) . unwrap ( ) ;
40+ let options = || crates_index_diff:: index:: CloneOptions {
41+ repository_url : fixture_dir ( ) . unwrap ( ) . join ( "base" ) . display ( ) . to_string ( ) ,
42+ fetch_options : None ,
43+ } ;
44+ Index :: from_path_or_cloned_with_options ( tmp. path ( ) , options ( ) )
45+ . expect ( "successful clone to be created" ) ;
46+ Index :: from_path_or_cloned_with_options ( tmp. path ( ) , options ( ) )
47+ . expect ( "second instance re-uses existing clone" ) ;
48+ }
3649
3750fn index_ro ( ) -> crate :: Result < Index > {
38- let dir = git_testtools:: scripted_fixture_repo_read_only_with_args (
51+ let dir = fixture_dir ( ) ?;
52+ Ok ( Index :: from_path_or_cloned ( dir. join ( "clone" ) ) ?)
53+ }
54+
55+ fn fixture_dir ( ) -> crate :: Result < PathBuf > {
56+ Ok ( git_testtools:: scripted_fixture_repo_read_only_with_args (
3957 "make-index-from-parts.sh" ,
4058 std:: env:: current_dir ( )
4159 . ok ( )
4260 . map ( |p| p. to_str ( ) . unwrap ( ) . to_owned ( ) ) ,
43- ) ?;
44- Ok ( Index :: from_path_or_cloned ( dir. join ( "clone" ) ) ?)
61+ ) ?)
4562}
63+
64+ mod old;
Original file line number Diff line number Diff line change 11use crates_index_diff:: * ;
22use git2:: Reference ;
3- use serial_test:: serial;
43use std:: { env, path:: PathBuf } ;
54use tempdir:: TempDir ;
65
76const NUM_VERSIONS_AT_RECENT_COMMIT : usize = 39752 ;
87const REV_ONE_UNYANKED : & str = "f8cb00181" ;
98
10- #[ test]
11- #[ ignore] // This test takes too long for my taste, this library is stable by now
12- fn clone_if_needed ( ) {
13- let tmp = TempDir :: new ( "new-index" ) . unwrap ( ) ;
14- Index :: from_path_or_cloned ( tmp. path ( ) ) . expect ( "successful clone to be created" ) ;
15- Index :: from_path_or_cloned ( tmp. path ( ) ) . expect ( "second instance re-uses existing clone" ) ;
16- }
17-
189fn make_index ( ) -> ( Index , TempDir ) {
1910 let tmp = TempDir :: new ( "new-index" ) . unwrap ( ) ;
2011 let index = Index :: from_path_or_cloned (
@@ -34,7 +25,6 @@ fn origin_master_of(index: &Index) -> Reference<'_> {
3425}
3526
3627#[ test]
37- #[ serial]
3828#[ ignore]
3929fn quick_changes_since_last_fetch ( ) {
4030 let ( mut index, _tmp) = make_index ( ) ;
You can’t perform that action at this time.
0 commit comments