@@ -54,7 +54,7 @@ pub enum PathFreshness {
5454/// local git history.
5555///
5656/// `target_paths` should be a non-empty slice of paths (git `pathspec`s) relative to `git_dir`
57- /// or the current working directory whose modifications would invalidate the artifact.
57+ /// whose modifications would invalidate the artifact.
5858/// Each pathspec can also be a negative match, i.e. `:!foo`. This matches changes outside
5959/// the `foo` directory.
6060/// See https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
@@ -79,7 +79,7 @@ pub enum PathFreshness {
7979/// In that case we simply take the latest upstream commit, because on CI there is no need to avoid
8080/// redownloading.
8181pub fn check_path_modifications (
82- git_dir : Option < & Path > ,
82+ git_dir : & Path ,
8383 config : & GitConfig < ' _ > ,
8484 target_paths : & [ & str ] ,
8585 ci_env : CiEnv ,
@@ -109,7 +109,7 @@ pub fn check_path_modifications(
109109 // Do not include HEAD, as it is never an upstream commit
110110 // If we do not find an upstream commit in CI, something is seriously wrong.
111111 Some (
112- get_closest_upstream_commit ( git_dir, config, ci_env) ?
112+ get_closest_upstream_commit ( Some ( git_dir) , config, ci_env) ?
113113 . expect ( "No upstream commit was found on CI" ) ,
114114 )
115115 } else {
@@ -124,7 +124,7 @@ pub fn check_path_modifications(
124124 ) ?;
125125 match upstream_with_modifications {
126126 Some ( sha) => Some ( sha) ,
127- None => get_closest_upstream_commit ( git_dir, config, ci_env) ?,
127+ None => get_closest_upstream_commit ( Some ( git_dir) , config, ci_env) ?,
128128 }
129129 } ;
130130
@@ -145,12 +145,9 @@ pub fn check_path_modifications(
145145}
146146
147147/// Returns true if any of the passed `paths` have changed since the `base` commit.
148- pub fn has_changed_since ( git_dir : Option < & Path > , base : & str , paths : & [ & str ] ) -> bool {
148+ pub fn has_changed_since ( git_dir : & Path , base : & str , paths : & [ & str ] ) -> bool {
149149 let mut git = Command :: new ( "git" ) ;
150-
151- if let Some ( git_dir) = git_dir {
152- git. current_dir ( git_dir) ;
153- }
150+ git. current_dir ( git_dir) ;
154151
155152 git. args ( [ "diff-index" , "--quiet" , base, "--" ] ) . args ( paths) ;
156153
@@ -162,15 +159,12 @@ pub fn has_changed_since(git_dir: Option<&Path>, base: &str, paths: &[&str]) ->
162159/// Returns the latest commit that modified `target_paths`, or `None` if no such commit was found.
163160/// If `author` is `Some`, only considers commits made by that author.
164161fn get_latest_commit_that_modified_files (
165- git_dir : Option < & Path > ,
162+ git_dir : & Path ,
166163 target_paths : & [ & str ] ,
167164 author : & str ,
168165) -> Result < Option < String > , String > {
169166 let mut git = Command :: new ( "git" ) ;
170-
171- if let Some ( git_dir) = git_dir {
172- git. current_dir ( git_dir) ;
173- }
167+ git. current_dir ( git_dir) ;
174168
175169 git. args ( [ "rev-list" , "-n1" , "--first-parent" , "HEAD" , "--author" , author] ) ;
176170
0 commit comments