Skip to content

Commit 6faa666

Browse files
authored
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
1 parent 4593492 commit 6faa666

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

aliases/git/git-aliases.nu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export def git_main_branch [] {
99
| str trim
1010
| find --regex 'HEAD .*?[:: ].+'
1111
| first
12+
| ansi strip
1213
| str replace --regex 'HEAD .*?[:: ]\s*(.+)' '$1'
1314
}
1415

0 commit comments

Comments
 (0)