diff options
author | kylo252 <[email protected]> | 2021-12-01 21:24:48 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-12-01 21:24:48 +0100 |
commit | e0336ed029f8368fb1c7a0240f93af1ccf409ffd (patch) | |
tree | 0b63e5459e6ab5c6d35b786dfd8deac48ce0a6c1 /lua/lvim/bootstrap.lua | |
parent | 3cae67b08b387964582b83fc28af7270cc326773 (diff) |
fix: more accessible changelog (#2019)
Diffstat (limited to 'lua/lvim/bootstrap.lua')
-rw-r--r-- | lua/lvim/bootstrap.lua | 17 |
1 files changed, 15 insertions, 2 deletions
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 |