Skip to content

Commit cafc608

Browse files
author
tlipinski
committed
refactor: simplify git version detection logic
1 parent b141a95 commit cafc608

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

build.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,7 @@ fn main() {
77
}
88

99
fn get_git_version() -> String {
10-
let tag = git_output(&["describe", "--tags", "--exact-match"]);
11-
12-
tag.unwrap_or({
13-
match (
14-
git_output(&["rev-list", "--count", "HEAD"]),
15-
git_output(&["rev-parse", "--short=7", "HEAD"]),
16-
) {
17-
(Some(rev_count), Some(short_hash)) => format!("r{rev_count}.{short_hash}"),
18-
_ => env!("CARGO_PKG_VERSION").to_string(),
19-
}
20-
})
10+
git_output(&["describe", "--tags"]).unwrap_or(env!("CARGO_PKG_VERSION").to_string())
2111
}
2212

2313
fn git_output(args: &[&str]) -> Option<String> {

0 commit comments

Comments
 (0)