scmbreeze / scm_breeze

Adds numbered shortcuts to the output git status, and much more
https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/
MIT License
2.82k stars 192 forks source link

ll failed in Monterey Mac #312

Closed aimuch closed 2 years ago

aimuch commented 2 years ago

image

kunalkundaje commented 2 years ago

You can replace the default BSD-flavored version of ls with the GNU version to get back that option. brew install coreutils will get you these tools. Some more info here: https://stackoverflow.com/a/57973942

aimuch commented 2 years ago

You can replace the default BSD-flavored version of ls with the GNU version to get back that option. brew install coreutils will get you these tools. Some more info here: https://stackoverflow.com/a/57973942

Think you, it works.👍

pre commented 2 years ago

A symlink worked for me, without having to add everything from coreutils into my $PATH:

brew install coreutils
ln -s /usr/local/opt/coreutils/libexec/gnubin/ls /usr/local/bin

Then ensure /usr/local/bin is in your $PATH before /bin.

I first tried an alias ls=/usr/local/opt/coreutils/libexec/gnubin/ls but this didn't work since SCM Breeze refers to \ls which disregards any aliases.

gcaprio commented 2 years ago

Sadly this didn't work for me. Any progress on getting this fixed in the core release?

ghthor commented 2 years ago

I don't have the hardware to test, so I haven't done any work concerning this.

tommym9 commented 2 years ago

Bumping into this one on Monterey too

alecalve commented 2 years ago

brew install coreutils and this patch fixed it for me:

diff --git a/lib/git/shell_shortcuts.sh b/lib/git/shell_shortcuts.sh
index 43b7215..052b663 100644
--- a/lib/git/shell_shortcuts.sh
+++ b/lib/git/shell_shortcuts.sh
@@ -116,10 +116,10 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && builtin command -v ruby > /dev/nu
     local ll_output
     local ll_command  # Ensure sort ordering of the two invocations is the same
     if [ "$_ls_bsd" != "BSD" ]; then
-      ll_command=(\ls -hv --group-directories-first)
+      ll_command=(\gls -hv --group-directories-first)
       ll_output="$("${ll_command[@]}" -l --color "$@")"
     else
-      ll_command=(\ls)
+      ll_command=(\gls)
       ll_output="$(CLICOLOR_FORCE=1 "${ll_command[@]}" -lG "$@")"
     fi
patbl commented 2 years ago

There's already code that's meant to identify macOS, but it's broken on recent macOS versions:

https://github.com/scmbreeze/scm_breeze/blob/24d08174e797034eafac79ee9c9309d7e556f21e/lib/git/shell_shortcuts.sh#L100-L103

This code runs ls --color=auto and checks whether that results in an error. If it does, the code assumes that the OS is macOS (technically BSD). According to https://github.com/fish-shell/fish-shell/issues/8309, Big Sur added a --color option to ls. So the exit status of ls --color=auto no longer differentiates the BSD version of ls from the GNU version.

patbl commented 2 years ago

An easy fix would be to use something like ls --author instead of ls --color=auto.