File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,25 @@ pub fn version() -> String {
8383 return String :: from ( v) ;
8484 }
8585
86- let version = env ! ( "CARGO_PKG_VERSION" ) ;
86+ const MAJOR : & str = env ! ( "CARGO_PKG_VERSION_MAJOR" ) ;
87+ const MINOR : & str = env ! ( "CARGO_PKG_VERSION_MINOR" ) ;
88+ const PATCH : & str = env ! ( "CARGO_PKG_VERSION_PATCH" ) ;
89+
90+ let minor_prefix = if MINOR . len ( ) == 1 {
91+ // Print single-digit months in '0M' format.
92+ "0"
93+ } else {
94+ ""
95+ } ;
96+
8797 let commit =
8898 option_env ! ( "NIRI_BUILD_COMMIT" ) . unwrap_or ( git_version ! ( fallback = "unknown commit" ) ) ;
8999
90- format ! ( "{version} ({commit})" )
100+ if PATCH == "0" {
101+ format ! ( "{MAJOR}.{minor_prefix}{MINOR} ({commit})" )
102+ } else {
103+ format ! ( "{MAJOR}.{minor_prefix}{MINOR}.{PATCH} ({commit})" )
104+ }
91105}
92106
93107pub fn get_monotonic_time ( ) -> Duration {
You can’t perform that action at this time.
0 commit comments