mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-12-24 11:02:44 +00:00
Apply patch from perillamint on github
use git hash to describe version number
This commit is contained in:
parent
d4e51a1afa
commit
5f5c34640f
2 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ fn git_info() {
|
|||
if output.status.success() {
|
||||
let git_hash = String::from_utf8_lossy(&output.stdout);
|
||||
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
||||
println!("cargo:rustc-env=GIT_SHORT_HASH={}", &git_hash[..8])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ impl Config {
|
|||
|
||||
fn git_version() -> Option<String> {
|
||||
let branch = Self::git_branch()?;
|
||||
let hash = Self::git_hash()?;
|
||||
let hash = Self::git_short_hash()?;
|
||||
|
||||
Some(format!("{}-{}", branch, hash))
|
||||
}
|
||||
|
@ -388,6 +388,10 @@ impl Config {
|
|||
option_env!("GIT_HASH")
|
||||
}
|
||||
|
||||
fn git_short_hash() -> Option<&'static str> {
|
||||
option_env!("GIT_SHORT_HASH")
|
||||
}
|
||||
|
||||
pub(crate) fn user_agent(&self) -> String {
|
||||
format!(
|
||||
"{} ({}/{}; +{})",
|
||||
|
|
Loading…
Reference in a new issue