@@ -10,7 +10,7 @@ fn test_pr_ci_unchanged_anywhere() {
10
10
git_test ( |ctx| {
11
11
let sha = ctx. create_upstream_merge ( & [ "a" ] ) ;
12
12
ctx. create_nonupstream_merge ( & [ "b" ] ) ;
13
- let src = ctx. get_source ( & [ "c" ] , CiEnv :: GitHubActions ) ;
13
+ let src = ctx. check_modifications ( & [ "c" ] , CiEnv :: GitHubActions ) ;
14
14
assert_eq ! ( src, PathFreshness :: LastModifiedUpstream { upstream: sha } ) ;
15
15
} ) ;
16
16
}
@@ -20,7 +20,7 @@ fn test_pr_ci_changed_in_pr() {
20
20
git_test ( |ctx| {
21
21
let sha = ctx. create_upstream_merge ( & [ "a" ] ) ;
22
22
ctx. create_nonupstream_merge ( & [ "b" ] ) ;
23
- let src = ctx. get_source ( & [ "b" ] , CiEnv :: GitHubActions ) ;
23
+ let src = ctx. check_modifications ( & [ "b" ] , CiEnv :: GitHubActions ) ;
24
24
assert_eq ! ( src, PathFreshness :: HasLocalModifications { upstream: sha } ) ;
25
25
} ) ;
26
26
}
@@ -30,7 +30,7 @@ fn test_auto_ci_unchanged_anywhere_select_parent() {
30
30
git_test ( |ctx| {
31
31
let sha = ctx. create_upstream_merge ( & [ "a" ] ) ;
32
32
ctx. create_upstream_merge ( & [ "b" ] ) ;
33
- let src = ctx. get_source ( & [ "c" ] , CiEnv :: GitHubActions ) ;
33
+ let src = ctx. check_modifications ( & [ "c" ] , CiEnv :: GitHubActions ) ;
34
34
assert_eq ! ( src, PathFreshness :: LastModifiedUpstream { upstream: sha } ) ;
35
35
} ) ;
36
36
}
@@ -40,7 +40,7 @@ fn test_auto_ci_changed_in_pr() {
40
40
git_test ( |ctx| {
41
41
let sha = ctx. create_upstream_merge ( & [ "a" ] ) ;
42
42
ctx. create_upstream_merge ( & [ "b" , "c" ] ) ;
43
- let src = ctx. get_source ( & [ "c" , "d" ] , CiEnv :: GitHubActions ) ;
43
+ let src = ctx. check_modifications ( & [ "c" , "d" ] , CiEnv :: GitHubActions ) ;
44
44
assert_eq ! ( src, PathFreshness :: HasLocalModifications { upstream: sha } ) ;
45
45
} ) ;
46
46
}
@@ -53,7 +53,7 @@ fn test_local_uncommitted_modifications() {
53
53
ctx. modify ( "a" ) ;
54
54
55
55
assert_eq ! (
56
- ctx. get_source ( & [ "a" , "d" ] , CiEnv :: None ) ,
56
+ ctx. check_modifications ( & [ "a" , "d" ] , CiEnv :: None ) ,
57
57
PathFreshness :: HasLocalModifications { upstream: sha }
58
58
) ;
59
59
} ) ;
@@ -71,7 +71,7 @@ fn test_local_committed_modifications() {
71
71
ctx. commit ( ) ;
72
72
73
73
assert_eq ! (
74
- ctx. get_source ( & [ "a" , "d" ] , CiEnv :: None ) ,
74
+ ctx. check_modifications ( & [ "a" , "d" ] , CiEnv :: None ) ,
75
75
PathFreshness :: HasLocalModifications { upstream: sha }
76
76
) ;
77
77
} ) ;
@@ -87,7 +87,7 @@ fn test_local_committed_modifications_subdirectory() {
87
87
ctx. commit ( ) ;
88
88
89
89
assert_eq ! (
90
- ctx. get_source ( & [ "a/b" ] , CiEnv :: None ) ,
90
+ ctx. check_modifications ( & [ "a/b" ] , CiEnv :: None ) ,
91
91
PathFreshness :: HasLocalModifications { upstream: sha }
92
92
) ;
93
93
} ) ;
@@ -100,7 +100,7 @@ fn test_local_changes_in_head_upstream() {
100
100
// even if it is currently HEAD
101
101
let sha = ctx. create_upstream_merge ( & [ "a" ] ) ;
102
102
assert_eq ! (
103
- ctx. get_source ( & [ "a" , "d" ] , CiEnv :: None ) ,
103
+ ctx. check_modifications ( & [ "a" , "d" ] , CiEnv :: None ) ,
104
104
PathFreshness :: LastModifiedUpstream { upstream: sha }
105
105
) ;
106
106
} ) ;
@@ -117,7 +117,7 @@ fn test_local_changes_in_previous_upstream() {
117
117
ctx. modify ( "d" ) ;
118
118
ctx. commit ( ) ;
119
119
assert_eq ! (
120
- ctx. get_source ( & [ "a" ] , CiEnv :: None ) ,
120
+ ctx. check_modifications ( & [ "a" ] , CiEnv :: None ) ,
121
121
PathFreshness :: LastModifiedUpstream { upstream: sha }
122
122
) ;
123
123
} ) ;
@@ -135,7 +135,7 @@ fn test_local_no_upstream_commit_with_changes() {
135
135
ctx. modify ( "d" ) ;
136
136
ctx. commit ( ) ;
137
137
assert_eq ! (
138
- ctx. get_source ( & [ "x" ] , CiEnv :: None ) ,
138
+ ctx. check_modifications ( & [ "x" ] , CiEnv :: None ) ,
139
139
PathFreshness :: LastModifiedUpstream { upstream: sha }
140
140
) ;
141
141
} ) ;
@@ -144,7 +144,7 @@ fn test_local_no_upstream_commit_with_changes() {
144
144
#[ test]
145
145
fn test_local_no_upstream_commit ( ) {
146
146
git_test ( |ctx| {
147
- let src = ctx. get_source ( & [ "c" , "d" ] , CiEnv :: None ) ;
147
+ let src = ctx. check_modifications ( & [ "c" , "d" ] , CiEnv :: None ) ;
148
148
assert_eq ! ( src, PathFreshness :: MissingUpstream ) ;
149
149
} ) ;
150
150
}
@@ -159,15 +159,15 @@ fn test_local_changes_negative_path() {
159
159
ctx. commit ( ) ;
160
160
161
161
assert_eq ! (
162
- ctx. get_source ( & [ ":!b" , ":!d" ] , CiEnv :: None ) ,
162
+ ctx. check_modifications ( & [ ":!b" , ":!d" ] , CiEnv :: None ) ,
163
163
PathFreshness :: LastModifiedUpstream { upstream: upstream. clone( ) }
164
164
) ;
165
165
assert_eq ! (
166
- ctx. get_source ( & [ ":!c" ] , CiEnv :: None ) ,
166
+ ctx. check_modifications ( & [ ":!c" ] , CiEnv :: None ) ,
167
167
PathFreshness :: HasLocalModifications { upstream: upstream. clone( ) }
168
168
) ;
169
169
assert_eq ! (
170
- ctx. get_source ( & [ ":!d" , ":!x" ] , CiEnv :: None ) ,
170
+ ctx. check_modifications ( & [ ":!d" , ":!x" ] , CiEnv :: None ) ,
171
171
PathFreshness :: HasLocalModifications { upstream }
172
172
) ;
173
173
} ) ;
@@ -198,7 +198,7 @@ impl GitCtx {
198
198
ctx
199
199
}
200
200
201
- fn get_source ( & self , target_paths : & [ & str ] , ci_env : CiEnv ) -> PathFreshness {
201
+ fn check_modifications ( & self , target_paths : & [ & str ] , ci_env : CiEnv ) -> PathFreshness {
202
202
check_path_modifications ( Some ( self . dir . path ( ) ) , & self . git_config ( ) , target_paths, ci_env)
203
203
. unwrap ( )
204
204
}
0 commit comments