File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/tools/build_helper/src Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ pub fn updated_master_branch(
9696 Err ( "Cannot find any suitable upstream master branch" . to_owned ( ) )
9797}
9898
99+ /// Finds the nearest merge commit by comparing the local `HEAD` with the upstream branch's state.
100+ /// To work correctly, the upstream remote must be properly configured using `git remote add <name> <url>`.
101+ /// In most cases `get_closest_merge_commit` is the function you are looking for as it doesn't require remote
102+ /// to be configured.
99103fn get_git_merge_base ( config : & GitConfig < ' _ > , git_dir : Option < & Path > ) -> Result < String , String > {
100104 let updated_master = updated_master_branch ( config, git_dir) ?;
101105 let mut git = Command :: new ( "git" ) ;
@@ -105,9 +109,10 @@ fn get_git_merge_base(config: &GitConfig<'_>, git_dir: Option<&Path>) -> Result<
105109 Ok ( output_result ( git. arg ( "merge-base" ) . arg ( & updated_master) . arg ( "HEAD" ) ) ?. trim ( ) . to_owned ( ) )
106110}
107111
108- /// Resolves the closest merge commit by the given `author` and `target_paths` .
112+ /// Searches for the nearest merge commit in the repository .
109113///
110- /// If it fails to find the commit from upstream using `git merge-base`, fallbacks to HEAD.
114+ /// If it fails to find the upstream remote, it then looks for the most recent commit made
115+ /// by the merge bot by matching the author's email address with the merge bot's email.
111116pub fn get_closest_merge_commit (
112117 git_dir : Option < & Path > ,
113118 config : & GitConfig < ' _ > ,
You can’t perform that action at this time.
0 commit comments