From e0336ed029f8368fb1c7a0240f93af1ccf409ffd Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 1 Dec 2021 21:24:48 +0100 Subject: fix: more accessible changelog (#2019) --- lua/lvim/bootstrap.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lua/lvim/bootstrap.lua') diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 7545b3be..44705a53 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -175,10 +175,23 @@ end function M:get_version(type) type = type or "" local opts = { cwd = get_lvim_base_dir() } - local status_ok, results = git_cmd({ "describe", "--tags" }, opts) + + local _, branch = git_cmd({ "branch", "--show-current" }, opts) + + local is_on_master = branch == "master" + if not is_on_master then + local log_status_ok, log_results = git_cmd({ "log", "--pretty=format:%h", "-1" }, opts) + local abbrev_version = log_results[1] or "" + if not log_status_ok or string.match(abbrev_version, "%d") == nil then + return nil + end + return "dev-" .. abbrev_version + end + + local tag_status_ok, results = git_cmd({ "describe", "--tags" }, opts) local lvim_full_ver = results[1] or "" - if not status_ok or string.match(lvim_full_ver, "%d") == nil then + if not tag_status_ok or string.match(lvim_full_ver, "%d") == nil then return nil end if type == "short" then -- cgit v1.2.3