mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
refactor(git)!: Start deprecating current_branch function
This commit is contained in:
parent
118ffe6fc1
commit
bc45503bf8
2 changed files with 9 additions and 16 deletions
|
|
@ -254,7 +254,6 @@ receive further support.
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
|
| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
|
||||||
| `current_branch` | Returns the name of the current branch. |
|
|
||||||
| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
|
| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
|
||||||
| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
|
| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
|
||||||
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
|
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
|
||||||
|
|
@ -262,6 +261,7 @@ receive further support.
|
||||||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
||||||
| `gbda` | Deletes all merged branches |
|
| `gbda` | Deletes all merged branches |
|
||||||
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
||||||
|
| `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) |
|
||||||
|
|
||||||
### Work in Progress (WIP)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,6 @@ git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
|
||||||
# (order should follow README)
|
# (order should follow README)
|
||||||
#
|
#
|
||||||
|
|
||||||
# The name of the current branch
|
|
||||||
# Back-compatibility wrapper for when this function was defined here in
|
|
||||||
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
|
|
||||||
# to fix the core -> git plugin dependency.
|
|
||||||
function current_branch() {
|
|
||||||
git_current_branch
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check for develop and similarly named branches
|
# Check for develop and similarly named branches
|
||||||
function git_develop_branch() {
|
function git_develop_branch() {
|
||||||
command git rev-parse --git-dir &>/dev/null || return
|
command git rev-parse --git-dir &>/dev/null || return
|
||||||
|
|
@ -424,15 +416,16 @@ alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||||
|
|
||||||
unset git_version
|
unset git_version
|
||||||
|
|
||||||
# Logic for adding warnings on deprecated aliases
|
# Logic for adding warnings on deprecated aliases or functions
|
||||||
local old_alias new_alias
|
local old_name new_name
|
||||||
for old_alias new_alias (
|
for old_name new_name (
|
||||||
|
current_branch git_current_branch
|
||||||
ggpull ggl
|
ggpull ggl
|
||||||
ggpur ggu
|
ggpur ggu
|
||||||
ggpush ggp
|
ggpush ggp
|
||||||
); do
|
); do
|
||||||
aliases[$old_alias]="
|
aliases[$old_name]="
|
||||||
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
|
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_name}%F{yellow}' is deprecated, using '%F{green}${new_name}%F{yellow}' instead.%f\"
|
||||||
$new_alias"
|
$new_name"
|
||||||
done
|
done
|
||||||
unset old_alias new_alias
|
unset old_name new_name
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue