From 6faa666e558bc53be9bf8836d4d1734926fa84d2 Mon Sep 17 00:00:00 2001 From: Filipp Samoilov Date: Mon, 30 Jun 2025 14:25:48 +0300 Subject: [PATCH] Strip ANSI from the main branch name (#1139) `find` highlights the returned value, which breaks the `gcm` macro, it returns ``` error: pathspec '?[37m?[0m?[41;37mmain?[0m?[37m?[0m' did not match any file(s) known to git ``` I opted in to using `ansi strip` instead of `--no-highlight`, because I think it covers wider range of nu shell versions --- aliases/git/git-aliases.nu | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/git/git-aliases.nu b/aliases/git/git-aliases.nu index 540132e..488d57f 100644 --- a/aliases/git/git-aliases.nu +++ b/aliases/git/git-aliases.nu @@ -9,6 +9,7 @@ export def git_main_branch [] { | str trim | find --regex 'HEAD .*?[:: ].+' | first + | ansi strip | str replace --regex 'HEAD .*?[:: ]\s*(.+)' '$1' }