diff --git a/src/commands/build/upload.rs b/src/commands/build/upload.rs index 2057aca0e6..923dda5f48 100644 --- a/src/commands/build/upload.rs +++ b/src/commands/build/upload.rs @@ -113,7 +113,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { .get_one("head_sha") .map(String::as_str) .map(Cow::Borrowed) - .or_else(|| vcs::find_head().ok().map(Cow::Owned)); + .or_else(|| vcs::find_head_sha().ok().map(Cow::Owned)); let cached_remote = config.get_cached_vcs_remote(); // Try to open the git repository and find the remote, but handle errors gracefully. diff --git a/src/utils/releases.rs b/src/utils/releases.rs index a37b97a69f..6d062ab9d2 100644 --- a/src/utils/releases.rs +++ b/src/utils/releases.rs @@ -158,7 +158,8 @@ pub fn detect_release_name() -> Result { } } - match vcs::find_head() { + // finally try the git sha + match vcs::find_head_sha() { Ok(head) => Ok(head), Err(e) => Err(anyhow!( "Could not automatically determine release name:\n\t {e} \n\n\ diff --git a/src/utils/vcs.rs b/src/utils/vcs.rs index a8c042250b..1c52678141 100644 --- a/src/utils/vcs.rs +++ b/src/utils/vcs.rs @@ -554,7 +554,7 @@ fn find_matching_revs( Ok((prev_rev, rev)) } -pub fn find_head() -> Result { +pub fn find_head_sha() -> Result { if let Some(pr_head_sha) = std::env::var("GITHUB_EVENT_PATH") .ok() .and_then(|event_path| std::fs::read_to_string(event_path).ok()) @@ -1678,7 +1678,7 @@ mod tests { fs::write(&event_file, pr_json).expect("Failed to write event file"); std::env::set_var("GITHUB_EVENT_PATH", event_file.to_str().unwrap()); - let result = find_head(); + let result = find_head_sha(); std::env::remove_var("GITHUB_EVENT_PATH"); assert!(result.is_ok());