Skip to content

Commit 0a539c6

Browse files
committed
ref(vcs): Rename find_head -> find_head_sha to match find_base_sha
1 parent 83d9b83 commit 0a539c6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/commands/build/upload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
113113
.get_one("head_sha")
114114
.map(String::as_str)
115115
.map(Cow::Borrowed)
116-
.or_else(|| vcs::find_head().ok().map(Cow::Owned));
116+
.or_else(|| vcs::find_head_sha().ok().map(Cow::Owned));
117117

118118
let cached_remote = config.get_cached_vcs_remote();
119119
// Try to open the git repository and find the remote, but handle errors gracefully.

src/utils/releases.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ pub fn detect_release_name() -> Result<String> {
158158
}
159159
}
160160

161-
match vcs::find_head() {
161+
// finally try the git sha
162+
match vcs::find_head_sha() {
162163
Ok(head) => Ok(head),
163164
Err(e) => Err(anyhow!(
164165
"Could not automatically determine release name:\n\t {e} \n\n\

src/utils/vcs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ fn find_matching_revs(
554554
Ok((prev_rev, rev))
555555
}
556556

557-
pub fn find_head() -> Result<String> {
557+
pub fn find_head_sha() -> Result<String> {
558558
if let Some(pr_head_sha) = std::env::var("GITHUB_EVENT_PATH")
559559
.ok()
560560
.and_then(|event_path| std::fs::read_to_string(event_path).ok())
@@ -1678,7 +1678,7 @@ mod tests {
16781678
fs::write(&event_file, pr_json).expect("Failed to write event file");
16791679

16801680
std::env::set_var("GITHUB_EVENT_PATH", event_file.to_str().unwrap());
1681-
let result = find_head();
1681+
let result = find_head_sha();
16821682
std::env::remove_var("GITHUB_EVENT_PATH");
16831683

16841684
assert!(result.is_ok());

0 commit comments

Comments
 (0)