Skip to content

Dynamic completion fails on Fish for Windows/MSYS2 #8250

@Nahor

Description

@Nahor

Environment: Windows MSYS2, with package mingw-w64-ucrt-x86_64-jj 0.36.0-1

Completion on Fish under MSYS2 fails because the path to jj.exe is invalid:

$ jj<tab>
fish: Unknown command: 'C:\\msys64\\ucrt64\\bin\\jj.exe'
fish:
COMPLETE=fish "C:\msys64\ucrt64\bin\jj.exe" -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^
in command substitution

(slightly approximate output since things are a bit messed and hard to read otherwise)

Also:

$ COMPLETE=fish jj
complete --keep-order --exclusive --command jj --arguments "(COMPLETE=fish "'"C:\\msys64\\ucrt64\\bin\\jj.exe"'" -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"

In both cases, note the C:\msys64\ucrt64\bin\jj.exe, which is is not a valid path under Cygwin or MSYS2.

Using c:/msys64/ucrt64/bin/jj.exe (i.e. forward slashes instead of back slashes) works:

$ COMPLETE=fish jj | sed 's#\\\\\\\\#/#g' | source
$ jj c<tab>
commit  (Update the description and create a new change on top [default alias: ci])  config  (Manage config options
$ jj co

More generally, Windows accepts forward slashes as a path separator, including in Git-for-Windows Bash. So it should be safe to use that separator in jj unconditionally, it should work in all Windows environments.

Issue #7024 replaced some of those backslashes but seems to have missed this completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions