@@ -19,23 +19,6 @@ fn addition() -> crate::Result {
1919 Ok ( ( ) )
2020}
2121
22- #[ test]
23- fn addition2 ( ) -> crate :: Result {
24- let changes = changes2 ( index_ro ( ) ?, ":/initial commit" ) ?;
25- assert_eq ! ( changes. len( ) , 3228 ) ;
26- assert ! ( matches!(
27- changes
28- . first( )
29- . and_then( |c| c. added( ) . map( |v| v. name. as_str( ) ) ) ,
30- Some ( "gi-get-artifact" )
31- ) ) ;
32- assert ! ( matches!(
33- changes. last( ) . expect( "present" ) ,
34- Change :: Added ( CrateVersion { name, ..} ) if name == "gizmo"
35- ) ) ;
36- Ok ( ( ) )
37- }
38-
3922#[ test]
4023fn deletion ( ) -> crate :: Result {
4124 let changes = changes ( index_ro ( ) ?, "@~326" ) ?;
@@ -44,14 +27,6 @@ fn deletion() -> crate::Result {
4427 Ok ( ( ) )
4528}
4629
47- #[ test]
48- fn deletion2 ( ) -> crate :: Result {
49- let changes = changes2 ( index_ro ( ) ?, "@~326" ) ?;
50- assert_eq ! ( changes. len( ) , 1 ) ;
51- assert_eq ! ( changes. first( ) . and_then( |c| c. deleted( ) ) , Some ( "girl" ) ) ;
52- Ok ( ( ) )
53- }
54-
5530#[ test]
5631fn new_version ( ) -> crate :: Result {
5732 let changes = changes ( index_ro ( ) ?, ":/Updating crate `git-repository#0.22.1`" ) ?;
@@ -65,19 +40,6 @@ fn new_version() -> crate::Result {
6540 Ok ( ( ) )
6641}
6742
68- #[ test]
69- fn new_version2 ( ) -> crate :: Result {
70- let changes = changes2 ( index_ro ( ) ?, ":/Updating crate `git-repository#0.22.1`" ) ?;
71- assert_eq ! ( changes. len( ) , 1 ) ;
72- assert_eq ! (
73- changes
74- . first( )
75- . and_then( |c| c. added( ) . map( |v| v. name. as_str( ) ) ) ,
76- Some ( "git-repository" )
77- ) ;
78- Ok ( ( ) )
79- }
80-
8143#[ test]
8244fn yanked ( ) -> crate :: Result {
8345 let changes = changes ( index_ro ( ) ?, ":/Yanking crate `github_release_rs#0.1.0`" ) ?;
@@ -91,19 +53,6 @@ fn yanked() -> crate::Result {
9153 Ok ( ( ) )
9254}
9355
94- #[ test]
95- fn yanked2 ( ) -> crate :: Result {
96- let changes = changes2 ( index_ro ( ) ?, ":/Yanking crate `github_release_rs#0.1.0`" ) ?;
97- assert_eq ! ( changes. len( ) , 1 ) ;
98- assert_eq ! (
99- changes
100- . first( )
101- . and_then( |c| c. yanked( ) . map( |v| v. name. as_str( ) ) ) ,
102- Some ( "github_release_rs" )
103- ) ;
104- Ok ( ( ) )
105- }
106-
10756#[ test]
10857fn unyanked_crates_recognized_as_added ( ) -> crate :: Result {
10958 let changes = changes ( index_ro ( ) ?, ":/Unyanking crate `git2mail#0.3.2`" ) ?;
@@ -117,19 +66,6 @@ fn unyanked_crates_recognized_as_added() -> crate::Result {
11766 Ok ( ( ) )
11867}
11968
120- #[ test]
121- fn unyanked_crates_recognized_as_added2 ( ) -> crate :: Result {
122- let changes = changes2 ( index_ro ( ) ?, ":/Unyanking crate `git2mail#0.3.2`" ) ?;
123- assert_eq ! ( changes. len( ) , 1 ) ;
124- assert_eq ! (
125- changes
126- . first( )
127- . and_then( |c| c. added( ) . map( |v| v. name. as_str( ) ) ) ,
128- Some ( "git2mail" )
129- ) ;
130- Ok ( ( ) )
131- }
132-
13369#[ test]
13470fn normalization ( ) -> crate :: Result {
13571 let changes = changes ( index_ro ( ) ?, ":/normalize" ) ?;
@@ -141,17 +77,6 @@ fn normalization() -> crate::Result {
14177 Ok ( ( ) )
14278}
14379
144- #[ test]
145- fn normalization2 ( ) -> crate :: Result {
146- let changes = changes2 ( index_ro ( ) ?, ":/normalize" ) ?;
147- assert_eq ! (
148- changes. len( ) ,
149- 2356 , // should be 0
150- "normalization changes the representation, but the data itself stays the same, BUT we can't do it yet"
151- ) ;
152- Ok ( ( ) )
153- }
154-
15580fn changes ( mut index : Index , revspec : & str ) -> crate :: Result < Vec < Change > > {
15681 let ( prev, current) = {
15782 let repo = index. repository_mut ( ) ;
@@ -176,28 +101,3 @@ fn changes(mut index: Index, revspec: &str) -> crate::Result<Vec<Change>> {
176101 } ;
177102 Ok ( index. changes_between_commits ( prev, current) ?)
178103}
179-
180- fn changes2 ( mut index : Index , revspec : & str ) -> crate :: Result < Vec < Change > > {
181- let ( prev, current) = {
182- let repo = index. repository_mut ( ) ;
183- repo. object_cache_size_if_unset ( 4 * 1024 * 1024 ) ;
184- let commit = repo. rev_parse ( revspec) ?. single ( ) . unwrap ( ) ;
185- let ancestor_tree = commit
186- . object ( ) ?
187- . into_commit ( )
188- . parent_ids ( )
189- . next ( )
190- . and_then ( |parent| {
191- parent
192- . object ( )
193- . ok ( ) ?
194- . into_commit ( )
195- . tree_id ( )
196- . ok ( )
197- . map ( |id| id. detach ( ) )
198- } )
199- . unwrap_or_else ( || git:: hash:: ObjectId :: empty_tree ( repo. object_hash ( ) ) ) ;
200- ( ancestor_tree, commit. detach ( ) )
201- } ;
202- Ok ( index. changes_between_commits2 ( prev, current) ?)
203- }
0 commit comments