Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] prompt filter failed on mercurial repos if mercurial is not installed #2846

Closed
3 of 4 tasks
mheden opened this issue May 15, 2023 · 2 comments · Fixed by #2847
Closed
3 of 4 tasks

[Bug] prompt filter failed on mercurial repos if mercurial is not installed #2846

mheden opened this issue May 15, 2023 · 2 comments · Fixed by #2847

Comments

@mheden
Copy link

mheden commented May 15, 2023

Version Information

Cmder version:  1.3.21
Operating system: Windows 10, Version 22H2 (build 19045.2846)

Cmder Edition

Cmder Full (with Git)

Description of the issue

I had an old mercurial repo from a backup and when I entered that directory, the prompt function failed since I didn't have mercurial installed on my new machine.

How to reproduce

C:\tmp
λ mkdir hgtest

C:\tmp
λ cd hgtest\

C:\tmp\hgtest
λ hg init

C:\tmp\hgtest (default)
λ scoop uninstall mercurial
Uninstalling 'mercurial' (6.3.1).
Removing shim 'hg.shim'.
Removing shim 'hg.exe'.
Unlinking ~\scoop\apps\mercurial\current
'mercurial' was uninstalled.


prompt filter failed:
...rs\mheden\scoop\apps\cmder-full\current\vendor\clink.lua:552: attempt to get length of local 'output' (a boolean value)
stack traceback:
        ...rs\mheden\scoop\apps\cmder-full\current\vendor\clink.lua:552: in function '?'
        {prompt.lua}: in function <{prompt.lua}:223>
        {prompt.lua}: in function <{prompt.lua}:71>
        [C]: in function 'xpcall'
        {prompt.lua}: in function <{prompt.lua}:53>
        (...tail calls...)

It looks likte it has to do with clink so maybe the issue should go there but when I run clink standalone I don't get any branch information so I don't know how to get the error there.

Additional context

No response

Checklist

  • I have read the documentation.
  • I have searched for similar issues and found none that describe my issue.
  • I have reproduced the issue on the latest version of Cmder.
  • I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.
chrisant996 added a commit to chrisant996/cmder that referenced this issue May 15, 2023
Also fixes error when HEAD is not available in a git repo, e.g. due to a
corrupt repo.
@chrisant996 chrisant996 mentioned this issue May 15, 2023
@chrisant996
Copy link
Contributor

I reviewed the issue and Lua code; there are several bugs in the Cmder prompt filter code when git/svn/hg are missing, or when a git repo is corrupt.

I submitted PR #2847 which should fix the collection of issues, and also cleans luacheck warnings that have crept in over time (over 80 warnings).

@mheden
Copy link
Author

mheden commented May 16, 2023

Great, thank you for looking at this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants