mirror of
https://github.com/alacritty/alacritty.git
synced 2025-04-07 17:43:03 -04:00
Fix build without git
This commit is contained in:
parent
f15ef63edb
commit
f2b1bfdf37
2 changed files with 8 additions and 4 deletions
|
@ -13,6 +13,6 @@
|
|||
// limitations under the License.
|
||||
|
||||
fn main() {
|
||||
let hash = rustc_tools_util::get_commit_hash().expect("couldn't get commit hash");
|
||||
let hash = rustc_tools_util::get_commit_hash().unwrap_or_default();
|
||||
println!("cargo:rustc-env=GIT_HASH={}", hash);
|
||||
}
|
||||
|
|
|
@ -61,12 +61,16 @@ impl Default for Options {
|
|||
impl Options {
|
||||
/// Build `Options` from command line arguments.
|
||||
pub fn new() -> Self {
|
||||
let mut version = crate_version!().to_owned();
|
||||
let commit_hash = env!("GIT_HASH");
|
||||
if !commit_hash.is_empty() {
|
||||
version = format!("{} ({})", version, commit_hash);
|
||||
}
|
||||
|
||||
let mut options = Options::default();
|
||||
|
||||
let version_string = format!("{} ({})", crate_version!(), env!("GIT_HASH"));
|
||||
|
||||
let matches = App::new(crate_name!())
|
||||
.version(version_string.as_str())
|
||||
.version(version.as_str())
|
||||
.author(crate_authors!("\n"))
|
||||
.about(crate_description!())
|
||||
.arg(Arg::with_name("ref-test").long("ref-test").help("Generates ref test"))
|
||||
|
|
Loading…
Add table
Reference in a new issue