7984: Improve version display r=matklad a=lnicola

Maybe closes #7854

The version string for unreleased builds looks like this now:

```
$ rust-analyzer --version
rust-analyzer 2021-03-08-159-gc0459c535
```

Release builds should only have the tag name (`2021-03-15`).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2021-03-13 13:22:25 +00:00 committed by GitHub
commit ceffcf8a11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -39,8 +39,7 @@ fn set_rerun() {
}
fn rev() -> Option<String> {
let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().ok()?;
let output = Command::new("git").args(&["describe", "--tags"]).output().ok()?;
let stdout = String::from_utf8(output.stdout).ok()?;
let short_hash = stdout.get(0..7)?;
Some(short_hash.to_owned())
Some(stdout)
}