Ver Fonte

simplify zsh git repository name extraction

Solaris doesn't like `grep -o`.
Weiyi Lou há 13 anos atrás
pai
commit
348efaab48
1 ficheiros alterados com 3 adições e 4 exclusões
  1. 3 4
      zsh/omz-custom/cinaeco.zsh-theme

+ 3 - 4
zsh/omz-custom/cinaeco.zsh-theme

@@ -74,13 +74,12 @@ git_prompt_status() {
 }
 
 ## Override the default `current_repository` function
-## Cope with non-ssh repos by not relying on ':'. Instead, we look for the name
-## suffixed with .git
+## Cope with non-ssh repos by not relying on ':'. Instead, we look for text
+## between a '/' and '.git'.
 ##
 ## We don't need to test if HEAD is a symbolic ref - that gets controlled in
 ## git_prompt_info(). Unlike `current_branch` there are no oh-my-zsh shortcuts
 ## that will be broken if we don't test for this.
-## Is there another way? 4 pipelines seems excessive
 function current_repository() {
-  echo $(git remote -v | head -1 | grep -o '[^/]*\.git' | sed 's/\.git//')
+  echo $(git remote -v | head -1 | sed 's/.*\/\([^/]*\)\.git.*/\1/')
 }