From 4ada412a05632c9d55907a35a6429f231c2dca2e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 2 Apr 2020 16:51:48 +0300 Subject: [PATCH] v2: stage 2 for enhancing 'v version' with the current git commit hash --- vlib/v/util/util.v | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 5718f525a4..e0ee866be4 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -20,12 +20,7 @@ pub fn vhash() string { pub fn full_hash() string { build_hash := vhash() current_hash := githash(false) - final_hash := if build_hash == current_hash { - build_hash - } else { - '${build_hash}.${current_hash}' - } - return final_hash + return '${build_hash}.${current_hash}' } // full_v_version() returns the full version of the V compiler @@ -75,10 +70,8 @@ pub fn githash(should_get_from_filesystem bool) string { } break } - // TODO: use C.V_CURRENT_COMMIT_HASH at stage 2, after v.c is regenerated - // mut buf := [50]byte - // buf[0] = 0 - // C.snprintf(charptr(buf), 50, '%s', C.V_CURRENT_COMMIT_HASH) - // return tos_clone(buf) - return 'unknown' + mut buf := [50]byte + buf[0] = 0 + C.snprintf(charptr(buf), 50, '%s', C.V_CURRENT_COMMIT_HASH) + return tos_clone(buf) }