@@ -364,9 +364,10 @@ impl Step for Rustc {
364
364
cp ( "README.md" ) ;
365
365
// tiny morsel of metadata is used by rust-packaging
366
366
let version = build. rust_version ( ) ;
367
- let sha = build. rust_sha ( ) . unwrap_or ( "" ) ;
368
367
t ! ( t!( File :: create( overlay. join( "version" ) ) ) . write_all( version. as_bytes( ) ) ) ;
369
- t ! ( t!( File :: create( overlay. join( "git-commit-hash" ) ) ) . write_all( sha. as_bytes( ) ) ) ;
368
+ if let Some ( sha) = build. rust_sha ( ) {
369
+ t ! ( t!( File :: create( overlay. join( "git-commit-hash" ) ) ) . write_all( sha. as_bytes( ) ) ) ;
370
+ }
370
371
371
372
// On MinGW we've got a few runtime DLL dependencies that we need to
372
373
// include. The first argument to this script is where to put these DLLs
@@ -846,8 +847,9 @@ impl Step for PlainSourceTarball {
846
847
847
848
// Create the version file
848
849
write_file ( & plain_dst_src. join ( "version" ) , build. rust_version ( ) . as_bytes ( ) ) ;
849
- let sha = build. rust_sha ( ) . unwrap_or ( "" ) ;
850
- write_file ( & plain_dst_src. join ( "git-commit-hash" ) , sha. as_bytes ( ) ) ;
850
+ if let Some ( sha) = build. rust_sha ( ) {
851
+ write_file ( & plain_dst_src. join ( "git-commit-hash" ) , sha. as_bytes ( ) ) ;
852
+ }
851
853
852
854
// If we're building from git sources, we need to vendor a complete distribution.
853
855
if build. rust_info . is_git ( ) {
@@ -1160,9 +1162,10 @@ impl Step for Extended {
1160
1162
install ( & build. src . join ( "LICENSE-APACHE" ) , & overlay, 0o644 ) ;
1161
1163
install ( & build. src . join ( "LICENSE-MIT" ) , & overlay, 0o644 ) ;
1162
1164
let version = build. rust_version ( ) ;
1163
- let sha = build. rust_sha ( ) . unwrap_or ( "" ) ;
1164
1165
t ! ( t!( File :: create( overlay. join( "version" ) ) ) . write_all( version. as_bytes( ) ) ) ;
1165
- t ! ( t!( File :: create( overlay. join( "git-commit-hash" ) ) ) . write_all( sha. as_bytes( ) ) ) ;
1166
+ if let Some ( sha) = build. rust_sha ( ) {
1167
+ t ! ( t!( File :: create( overlay. join( "git-commit-hash" ) ) ) . write_all( sha. as_bytes( ) ) ) ;
1168
+ }
1166
1169
install ( & etc. join ( "README.md" ) , & overlay, 0o644 ) ;
1167
1170
1168
1171
// When rust-std package split from rustc, we needed to ensure that during
0 commit comments