Fix another pre-existing bug in the hg prompt.

If the hg program is not found, then there used to be a Lua script
error.  I fixed that in the earlier commit in this PR.  But the fix
was incomplete, and the hg prompt still appended " ()" instead of
not appending anything (which is how the svn prompt behaves when
the svn program is not found).
This commit is contained in:
Chris Antos
2025-09-14 10:34:23 -07:00
parent 8ec4789e35
commit 173b86fbc8

8
vendor/clink.lua vendored
View File

@@ -598,12 +598,8 @@ local function hg_prompt_filter()
local hg_dir = get_hg_dir() local hg_dir = get_hg_dir()
if hg_dir then if hg_dir then
local output = get_hg_branch() or "" local branch = get_hg_branch()
if branch and
-- strip the trailing spaces and newline from the branch name
local branch = output:gsub("%s+$", "")
if branch ~= nil and
string.sub(branch,1,7) ~= "abort: " and -- not an HG working copy string.sub(branch,1,7) ~= "abort: " and -- not an HG working copy
(not string.find(branch, "is not recognized")) then -- 'hg' not in path (not string.find(branch, "is not recognized")) then -- 'hg' not in path
-- If in a different repo or branch than last time, discard cached info -- If in a different repo or branch than last time, discard cached info