Skip to content

git branch -vl '*/*' returns nothing #5978

Closed

Description

@TechWatching

Describe the bug

When using the command git branch -vl '*/*' in a folder of a git repository. the command returns nothing.

When using PowerShell to execute the same command, it returns a list of git branches.

How to reproduce

  1. open nushell in a folder a of git repository
  2. execute the command git branch -vl '*/*'

Expected behavior

The command returns the list of branches of the git repository with "/" in them like : feature/1234-myaweomefeature

Screenshots

No response

Configuration

key value
version 0.65.0
branch
commit_hash 390d06d
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.62.0 (a8314ef7d 2022-06-27)
rust_channel stable-x86_64-pc-windows-msvc
cargo_version cargo 1.62.0 (a748cf5a3 2022-06-08)
pkg_version 0.65.0
build_time 2022-07-05 17:33:16 +00:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins

Additional context

It seems to me that the '/' is interpreted by nushell instead of being executed by the git command.

Activity

  1. added
    category:bug
    A:external-commands
    A:parser
    on Jul 7, 2022
  2. Kangaxx-0 commented on Jul 7, 2022

    @Kangaxx-0
    Contributor

    @fdncred When parse sees quotes, it will try trim_qoutes . I would like to hear your suggestions, how do we want to deal with trim vs not trim, should we give the control back to user to decide by adding a flag in nu config?

  3. fdncred commented on Jul 8, 2022

    @fdncred
    Contributor

    We need a string literal quote that gets passed through, which I thought was backticks. How do other shells handle this?

    With externals maybe we should just pass through whatever the user specifies as parameters. We'll have to resolve variables but maybe that should be it?

  4. Kangaxx-0 commented on Jul 8, 2022

    @Kangaxx-0
    Contributor

    I tested ZSH, the result was the same as nu. As you said, for external command, I feel like we should keep the parameters, but I don't know if this will introduce regression or not

  5. fdncred commented on Jul 8, 2022

    @fdncred
    Contributor

    @Kangaxx-0 for me it works in zsh and in fish
    Screen Shot 2022-07-08 at 11 02 37 AM

  6. Kangaxx-0 commented on Jul 8, 2022

    @Kangaxx-0
    Contributor

    It's weird, it does not work on Alacritty + tmux for me. Anyway, This is my thought to fix this issue:

    • Remove trim_qoute from external command parameters code, and see if users will complain this?
    • Add a flag in nu config, set the default is false, user is able to decide if they want to trim quotes during parsing ?
  7. fdncred commented on Jul 8, 2022

    @fdncred
    Contributor

    I know this issue here is a use case for not trimming quotes. What is a use case for trimming quotes?

    I'm not against what you're saying, I just don't understand why we'd want to trim them.

  8. Kangaxx-0 commented on Jul 8, 2022

    @Kangaxx-0
    Contributor

    Don't worry. I personally do not know the user case for trimming, I just want to be careful if there is one which I don't know. My point is - I don't want to introduce a new regression just by fixing this one.

    BTW, I did remove that trimming code in my local, at least, no test failed

  9. fdncred commented on Jul 8, 2022

    @fdncred
    Contributor

    I'm not really sure it's a "keep all the quotes" or "remove all the quotes" type of issue. JT just mentioned this use case.

    I think if we don't handle quotes correctly then things like git commit -m "my message" will put the quotes in the commit message

  10. Kangaxx-0 commented on Jul 8, 2022

    @Kangaxx-0
    Contributor

    Let me later run some investigations tho

  11. Kangaxx-0 commented on Jul 8, 2022

    @Kangaxx-0
    Contributor

    I'm not really sure it's a "keep all the quotes" or "remove all the quotes" type of issue. JT just mentioned this use case.

    I think if we don't handle quotes correctly then things like git commit -m "my message" will put the quotes in the commit message

    I could not reproduce what JT mentioned `git commit -m "my message"', it did not give me quotes in commit message, are you able to see his issue from your local?

    Also, regards to arg '*/*', it is not just a parser issue, when we eval external, what's more:

    • We trim quotes too
    • There is a chunk of code specifically takes care of *

    Since this thing involves several commits, I will make a summary, and call it out in implementation chat, then you guys could share thoughts there :)

  12. fdncred commented on Jul 9, 2022

    @fdncred
    Contributor

    I could not reproduce what JT mentioned `git commit -m "my message"', it did not give me quotes in commit message, are you able to see his issue from your local?

    It shouldn't give quotes. Maybe the point is, if all quotes were stripped then I'm not sure "my message" would come through as the commit message. Conversely, if quoting is done wrong it would show quotes in the commit message. This part you've confirmed doesn't happen right now.

  13. added this to the v0.66.0 milestone on Jul 18, 2022
  14. TechWatching commented on Jul 28, 2022

    @TechWatching
    ContributorAuthor

    @Kangaxx-0 @fdncred the PR corrected the issue (thanks btw), however, I am not sure it covers all use cases.

    For instance, I ran into a similar problem today when using Azure CLI. All commands in Azure CLI can take a JMESPath to filter on the output like this: az group list --query "[].name". This displays nothing using Nushell (version 0.66) whereas it displays the name of the resource groups using PowerShell. If I remove the --query [].name it works the same in PowerShell and Nushell.

    I don't know if I should open another issue, or if this issue should be reopened. Honestly, it is not a big deal for me as I don't need to use this query argument to filter or select, I can use Nushell for that. Yet if this causes a bug here it can also do it in other tools and people that start using Nushell as their primary shell will find it weird that their tools are not always working in Nushell.

  15. fdncred commented on Jul 28, 2022

    @fdncred
    Contributor

    @TechWatching Thanks for the feedback. Personally, I'd like to fix any and all issues surrounding external quoting and expansion, but I'm learning that it's not a trivial task to accomplish that. All help is appreciated.

  16. added a commit that references this issue on May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:external-commandsA:parsercategory:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions