nushell icon indicating copy to clipboard operation
nushell copied to clipboard

Cannot execute git command to checkout a pull request

Open charleschege opened this issue 3 years ago • 4 comments

Describe the bug

Running git fetch origin pull/92/head:0.6 on bash shell runs the command successfully, fetching a pull request and storing it in the branch called 0.6 in the command. However, nushell is unable to do this, I have tried adding quotes.

How to reproduce

Run git fetch origin pull/92/head:0.6 on nu shell

Expected behavior

❯ git fetch origin pull/92/head:0.6
Error: nu::parser::extra_positional (link)

  × Extra positional argument.
   ╭─[entry #25:1:1]
 1 │ git fetch origin pull/92/head:0.6
   ·                  ────────┬───────
   ·                          ╰── extra positional argument
   ╰────
  help: Usage: git fetch {flags} (repository)

Screenshots

No response

Configuration

No response

Additional context

No response

charleschege avatar Jul 25 '22 16:07 charleschege

I've seen this many times. I wouldn't be surprised if there was another issue. I'm pretty sure it has to do with the custom completions not accommodating all parameters. I typically put a ^ in front when this happens and it fixes the problem. Long term, the git custom completions need to be updated.

fdncred avatar Jul 25 '22 17:07 fdncred

This is because git fetch is being considered as internal command, if you check out config nu from terminal, you should see a custom command extern "git fetch", please try to remove it and it should do the magic

Kangaxx-0 avatar Jul 29 '22 21:07 Kangaxx-0

git push --force-with-lease also fails due to the same problem.

jansol avatar Nov 01 '22 00:11 jansol

Yup, every sub command or parameter that isn't implemented in the nushell custom completions will exhibit this same error.

fdncred avatar Nov 01 '22 01:11 fdncred