Przeglądaj źródła

Improve git repository name detection

We can now handle `user@server:repo (fetch)`
Weiyi Lou 10 lat temu
rodzic
commit
1eb1b76473
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      zsh/custom/cinaeco.zsh-theme

+ 2 - 3
zsh/custom/cinaeco.zsh-theme

@@ -134,10 +134,9 @@ function git_prompt_status() {
 
 # Read the current repository (override the default omz function)
 #
-# Cope with non-ssh repos by not relying on ':'. Instead, we look for text
-# between a '/' and whitespace. '.git' is removed.
+# Check for a name in git remotes, between ':' or '/' and a space.
 function current_repository() {
-  local repo=$(git remote -v | head -1 | sed 's/.*\/\([^/]*\)\ .*/\1/')
+  local repo=$(git remote -v | head -1 | sed 's/.*[\/|:]\([^/]*\) .*/\1/')
   echo ${repo%.git}
 }