4ad4a81657d044de2839e988ff3338fa398e5d9b

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

git: clean up plugin file and delete current_repository function

Closes #6329

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/git/README.md b/plugins/git/README.md
  2index 6cb73c11c26b5e56d310ba987d09ea2538f00cfb..d66ad234dfa4c9c6829acdfb8b03f48f4d8f0e32 100644
  3--- a/plugins/git/README.md
  4+++ b/plugins/git/README.md
  5@@ -191,7 +191,6 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
  6 | Command                | Description                             |
  7 |:-----------------------|:----------------------------------------|
  8 | current_branch         | Return the name of the current branch   |
  9-| current_repository     | Return the names of the current remotes |
 10 | git_current_user_name  | Returns the `user.name` config value    |
 11 | git_current_user_email | Returns the `user.email` config value   |
 12 
 13@@ -204,3 +203,9 @@ These features allow to pause a branch development and switch to another one (_"
 14 | work_in_progress | Echoes a warning if the current branch is a wip |
 15 | gwip             | Commit wip branch                               |
 16 | gunwip           | Uncommit wip branch                             |
 17+
 18+### Deprecated
 19+
 20+| Command                | Description                             | Reason                                                          |
 21+|:-----------------------|:----------------------------------------|:----------------------------------------------------------------|
 22+| current_repository     | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) |
 23diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
 24index b82d49b5ef90b9f0748873644f097f5495ad8d70..09998003afa0aa6914b00bc451ab0127d0d1cf85 100644
 25--- a/plugins/git/git.plugin.zsh
 26+++ b/plugins/git/git.plugin.zsh
 27@@ -1,7 +1,3 @@
 28-# Query/use custom command for `git`.
 29-zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
 30-: ${_omz_git_git_cmd:=git}
 31-
 32 #
 33 # Functions
 34 #
 35@@ -13,19 +9,15 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
 36 function current_branch() {
 37   git_current_branch
 38 }
 39-# The list of remotes
 40-function current_repository() {
 41-  if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
 42-    return
 43-  fi
 44-  echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
 45-}
 46+
 47 # Pretty log messages
 48 function _git_log_prettily(){
 49   if ! [ -z $1 ]; then
 50     git log --pretty=$1
 51   fi
 52 }
 53+compdef _git _git_log_prettily=git-log
 54+
 55 # Warn if the current branch is a WIP
 56 function work_in_progress() {
 57   if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
 58@@ -80,7 +72,6 @@ alias gcd='git checkout develop'
 59 alias gcmsg='git commit -m'
 60 alias gco='git checkout'
 61 alias gcount='git shortlog -sn'
 62-compdef _git gcount
 63 alias gcp='git cherry-pick'
 64 alias gcpa='git cherry-pick --abort'
 65 alias gcpc='git cherry-pick --continue'
 66@@ -89,35 +80,35 @@ alias gcs='git commit -S'
 67 alias gd='git diff'
 68 alias gdca='git diff --cached'
 69 alias gdcw='git diff --cached --word-diff'
 70-alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
 71+alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
 72 alias gds='git diff --staged'
 73 alias gdt='git diff-tree --no-commit-id --name-only -r'
 74 alias gdw='git diff --word-diff'
 75 
 76-gdv() { git diff -w "$@" | view - }
 77+function gdv() { git diff -w "$@" | view - }
 78 compdef _git gdv=git-diff
 79 
 80 alias gf='git fetch'
 81 alias gfa='git fetch --all --prune'
 82 alias gfo='git fetch origin'
 83 
 84-function gfg() { git ls-files | grep $@ }
 85-compdef _grep gfg
 86+alias gfg='git ls-files | grep'
 87 
 88 alias gg='git gui citool'
 89 alias gga='git gui citool --amend'
 90 
 91-ggf() {
 92+function ggf() {
 93   [[ "$#" != 1 ]] && local b="$(git_current_branch)"
 94   git push --force origin "${b:=$1}"
 95 }
 96-ggfl() {
 97+compdef _git ggf=git-checkout
 98+function ggfl() {
 99   [[ "$#" != 1 ]] && local b="$(git_current_branch)"
100   git push --force-with-lease origin "${b:=$1}"
101 }
102-compdef _git ggf=git-checkout
103+compdef _git ggfl=git-checkout
104 
105-ggl() {
106+function ggl() {
107   if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
108     git pull origin "${*}"
109   else
110@@ -127,7 +118,7 @@ ggl() {
111 }
112 compdef _git ggl=git-checkout
113 
114-ggp() {
115+function ggp() {
116   if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
117     git push origin "${*}"
118   else
119@@ -137,7 +128,7 @@ ggp() {
120 }
121 compdef _git ggp=git-checkout
122 
123-ggpnp() {
124+function ggpnp() {
125   if [[ "$#" == 0 ]]; then
126     ggl && ggp