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

panache-git: do not print stderr from Git commands #813

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

ehdevries
Copy link
Contributor

Nushell 0.92 changed how external commands operate in pipelines: https://www.nushell.sh/blog/2024-04-02-nushell_0_92_0.html

After updating to Nushell 0.92, panache-git would print errors when the current working directory was not a Git repository: "fatal: not a git repository (or any of the parent directories): .git"

This change properly handles stderr from Git commands according to Nushell's updated external command behavior.

Also, Nushell 0.91 introduced "is-not-empty", so places in the code where a string was checked for being not-empty or not-contains were simplified a bit.

Finally, the main command in the module was renamed to "main" to make it simpler to import and use in config.

Nushell 0.92 changed how external commands operate in pipelines:
https://www.nushell.sh/blog/2024-04-02-nushell_0_92_0.html

After updating to Nushell 0.92, panache-git would print errors
when the current working directory was not a Git repository:
"fatal: not a git repository (or any of the parent directories): .git"

This change properly handles stderr from Git commands
according to Nushell's updated external command behavior.

Also, Nushell 0.91 introduced "is-not-empty", so places in the code
where a string was checked for being not-empty or not-contains
were simplified a bit.

Finally, the main command in the module was renamed to "main"
to make it simpler to import and use in config.
@fdncred
Copy link
Collaborator

fdncred commented Apr 9, 2024

We plan to revisit the topic of do -i in our meeting tomorrow. So, let's hold off on this for the moment. Thanks.

@fdncred
Copy link
Collaborator

fdncred commented Apr 11, 2024

I've documented this in a couple places. Adding here too.

After discussing this in our team meeting yesterday, our decision was to try and simplify do and get rid of these parameters.

  • --ignore-errors/-i
  • --ignore-shell-errors/-s
  • --ignore-program-errors/-p
  • --capture-errors/-c

And replace them with better syntax for handling redirection. There's no ETA yet but that is the desired goal. In the mean time, I'll land the patch for panache-git that fixes the problem we introduced.

We may want to restore the do -i "eat all errors" functionality temporarily too.

@fdncred fdncred merged commit b1019da into nushell:main Apr 11, 2024
1 check passed
@ehdevries ehdevries deleted the panache-git-handle-stderr branch April 11, 2024 13:55
@neur1n
Copy link
Contributor

neur1n commented Apr 15, 2024

I applied this patch but error messages still get printed. I'm using nushell on Windows 11 and do not have access to a Linux machine currently.

@fdncred
Copy link
Collaborator

fdncred commented Apr 15, 2024

@neur1n I'm not having any issues with it on MacOS. I just added this to my config.nu.

use "modules/prompt/panache-git.nu" main
$env.PROMPT_COMMAND = { panache-git }

@neur1n
Copy link
Contributor

neur1n commented Apr 15, 2024

Sorry, it was my fault. I'm invoking another git command that is not in panache-git, without such a patch.

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

Successfully merging this pull request may close these issues.

3 participants