Skip to content

Commit

Permalink
Always go to the tree view regardless of commit or tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Insprill committed Mar 26, 2024
1 parent cf25403 commit ad1acfc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ fn set_repo_url() {

if is_git_repo() {
repo_url = get_remote_url();
if !repo_url.ends_with('/') {
repo_url.push('/');
}
if repo_url.starts_with("https://github.com/") {
if is_git_tagged() {
repo_url.push_str(&format!("releases/tag/{}", get_git_tag()));
} else {
repo_url.push_str(&format!("commit/{}", get_git_hash()));
}
// The URL might already end with a '/', but GitHub seems to handle it fine if there's two.
repo_url.push_str(&format!(
"/tree/{}",
if is_git_tagged() {
get_git_tag()
} else {
get_git_hash()
}
));
}
} else {
println!("Not a Git repo! Skipping repo URL metadata");
Expand Down

0 comments on commit ad1acfc

Please sign in to comment.