@@ -75,7 +75,7 @@ pub enum PathFreshness {
7575/// PR made modifications to `target_paths`. If not, then we simply take the latest upstream
7676/// commit, because on CI there is no need to avoid redownloading.
7777pub fn check_path_modifications (
78- git_dir : Option < & Path > ,
78+ git_dir : & Path ,
7979 config : & GitConfig < ' _ > ,
8080 target_paths : & [ & str ] ,
8181 ci_env : CiEnv ,
@@ -105,7 +105,7 @@ pub fn check_path_modifications(
105105 // Do not include HEAD, as it is never an upstream commit
106106 // If we do not find an upstream commit in CI, something is seriously wrong.
107107 Some (
108- get_closest_upstream_commit ( git_dir, config, ci_env) ?
108+ get_closest_upstream_commit ( Some ( git_dir) , config, ci_env) ?
109109 . expect ( "No upstream commit was found on CI" ) ,
110110 )
111111 } else {
@@ -120,7 +120,7 @@ pub fn check_path_modifications(
120120 ) ?;
121121 match upstream_with_modifications {
122122 Some ( sha) => Some ( sha) ,
123- None => get_closest_upstream_commit ( git_dir, config, ci_env) ?,
123+ None => get_closest_upstream_commit ( Some ( git_dir) , config, ci_env) ?,
124124 }
125125 } ;
126126
@@ -141,12 +141,9 @@ pub fn check_path_modifications(
141141}
142142
143143/// Returns true if any of the passed `paths` have changed since the `base` commit.
144- pub fn has_changed_since ( git_dir : Option < & Path > , base : & str , paths : & [ & str ] ) -> bool {
144+ pub fn has_changed_since ( git_dir : & Path , base : & str , paths : & [ & str ] ) -> bool {
145145 let mut git = Command :: new ( "git" ) ;
146-
147- if let Some ( git_dir) = git_dir {
148- git. current_dir ( git_dir) ;
149- }
146+ git. current_dir ( git_dir) ;
150147
151148 git. args ( [ "diff-index" , "--quiet" , base, "--" ] ) . args ( paths) ;
152149
@@ -158,15 +155,12 @@ pub fn has_changed_since(git_dir: Option<&Path>, base: &str, paths: &[&str]) ->
158155/// Returns the latest commit that modified `target_paths`, or `None` if no such commit was found.
159156/// If `author` is `Some`, only considers commits made by that author.
160157fn get_latest_commit_that_modified_files (
161- git_dir : Option < & Path > ,
158+ git_dir : & Path ,
162159 target_paths : & [ & str ] ,
163160 author : & str ,
164161) -> Result < Option < String > , String > {
165162 let mut git = Command :: new ( "git" ) ;
166-
167- if let Some ( git_dir) = git_dir {
168- git. current_dir ( git_dir) ;
169- }
163+ git. current_dir ( git_dir) ;
170164
171165 git. args ( [ "rev-list" , "-n1" , "--first-parent" , "HEAD" , "--author" , author] ) ;
172166
0 commit comments